While running a batch file from Windows 10 cmd I'm getting an error that a term is not recognised as cmdlet function - windows

This is the exact error on the cmd window.
this is the command I typed to be executed in the cmd
F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows>install.bat
CNTK Binary Install Script
F:\Fast : The term 'F:\Fast' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows\ps\inst ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (F:\Fast:String) [], CommandNotF
oundException
+ FullyQualifiedErrorId : CommandNotFoundException
Error during install operation
I've tried running as admin, direct clicking, changing the path etc. Kindly tell me a way to run this file. It's a batch file for a series of installations for the Microsoft cognitive tool kit.

Looks like you need to enclose the path in quotes
"F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows\install.bat"

use "start" before the filename.
Example:
F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows>start install.bat

Related

How to run .sh script in Intellij in Windows

I have a problem about running sh file in Intellij in Windows.
When I clicked the run button in the file, I got this output shown below.
PS C:\Users\username\IdeaProjects\library> /bin/sh C:/Users/username/IdeaProjects/library/aws-setup.sh
/bin/sh : The term '/bin/sh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify t
hat the path is correct and try again.
At line:1 char:1
+ /bin/sh C:/Users/username/IdeaProjects/library/aws-setup.sh
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (/bin/sh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How can I fix it?
Set Settings (Preferences on macOS) | Tools | Terminal | Shell path to c:\Program Files\Git\bin\bash.exe or use Shell Script run configuration with Interpreter path set to bash.exe:

After uninstalling Conda 3.8 cmd became unavailable

Overview
I uninstalled Conda and it broke cmd. I am unable to start cmd and I also get an error when opening a PS terminal. When I installed Conda I ran conda init for ps and cmd. I would like to reverse the effect of this command. I no longer have conda and so cannot use that.
Powershell behaviour:
conda : The term 'conda' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and
try again. At line:1 char:1
conda init --reverse
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cmd behaviour:
Doesn't open, brief flash of a window.
Resolution
In the registry, there is a key; HKEY_CURRENT_USER\Software\Microsoft\Command Processor\autorun with the value set to if exists. I removed that key's value. If you have a statement that runs batch scripts, don't just bin it.
What is this key?
According to this resource the key is used to run batch scripts prior to opening cmd.
Why?
if exist was evaluating to false and that blocked cmd from starting. I tested with a dummy expression if exist 1=1 which led to cmd starting.
Culprit
This happened when uninstalling Conda 3.8.

Anaconda Command Prompt Window Won't Open After Reinstallation

I have had to uninstall and then reinstall miniconda. After reinstalling, when I run, the powershell prompt shows the following message:
& : The term 'C:\Users\jenj0\anaconda3\Scripts\conda.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\jenj0\Documents\WindowsPowerShell\profile.ps1:4 char:4
+ (& "C:\Users\jenj0\anaconda3\Scripts\conda.exe" "shell.powershell" "h ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\jenj0\...ripts\conda.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
(base) PS C:\Users\jenj0>
Additionally, the miniconda command prompt window doesn't launch at all.
I tried looking for solutions. For example, I tried this, but when I try to launch cmd.exe, I see a quick flash of a window opening and then closing and nothing happens.
I have also tried uninstalling/reinstalling miniconda again and had the same issue. I was doing that because I was having issues to run a program. Now I am even further away from solving the problem.
There is some invalid paths in the startup scripts for powershell and also the registry keys for cmd, stemming from your previous anaconda installation.
You say that you uninstalled anaconda and then installed miniconda, so I am assuming that the path
C:\Users\jenj0\anaconda3
does not exist and is now
C:\Users\jenj0\miniconda3
Here is what you do:
Powershell (from your error message) is trying to read C:\Users\jenj0\Documents\WindowsPowerShell\profile.ps1 which contains references to the invalid path. Backup said file and then delete any lines that contain the invalid path
cmd (and anaconda prompt). Run regedit and then delete the reference to the invalid path in the keys at
Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

The term 'jmeter' is not recognized as the name of a cmdlet, function, script file, or operable program

The term 'jmeter' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
jmeter -n -t D:\apache-jmeter-2.13\apache-jmeter-
2.13\bin\zzz\zzz ...
~~~~~~
CategoryInfo : ObjectNotFound: (jmeter:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
Use 'cmd' instead of the Powershell console. Also may sure that you have Jmeter(folder installation)\bin in your PATH environment variable.
If you are on Windows 10 and using Windows PowerShell make sure you are inside JMeter's bin folder and start your command with .\jmeter instead of only jmeter.
.\jmeter -n -t D:\apache-jmeter-2.13\apache-jmeter- 2.13\bin\zzz\zzz ...

Errors when starting a PowerShell session

I was using PowerShell normally (was using posh git, just to mention), and suddenly a weird behavior happened, I tried to restart the session, when I did, I got many errors, which are :
Split-Path : The term 'Split-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\Users\aymen.daoudi\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1:1 char:16
+ Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -P ...
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Split-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Import-Module : The specified module '.\posh-git' was not loaded because no valid module file was found in any module directory.
At C:\Users\aymen.daoudi\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1:4 char:1
+ Import-Module .\posh-git
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (.\posh-git:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Enable-GitColors : The term 'Enable-GitColors' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\Users\aymen.daoudi\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1:26 char:1
+ Enable-GitColors
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Enable-GitColors:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Pop-Location : The term 'Pop-Location' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At C:\Users\aymen.daoudi\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1:28 char:1
+ Pop-Location
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Pop-Location:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Start-SshAgent : The term 'Start-SshAgent' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At C:\Users\aymen.daoudi\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1:30 char:1
+ Start-SshAgent -Quiet
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Start-SshAgent:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Here's a picture of that :
I tried to restart the PC, but still have the same problem every time I start a new PowerShell session, I noticed that many commands don't work, what caused this problem ? and what should I do to solve it ?
Update
I removed the profiles added by PoshGit, when starting a new session, I don't have any error, but powershell still doesn't recognize commands, for example calling Clear-host, throws lots of errors that I can't understand the cause !
You're PSModulePath system environment varaible is missing C:\windows\system32\WindowsPowerShell\v1.0\Modules which is the location of all "system"/built-in modules in PowerShell.
Something you've installed (posh git maybe?) has probably messed it up. Add it to the system variable.
The easiest way to do it without PowerShell is using the GUI as described here:
http://www.computerhope.com/issues/ch000549.htm
If you just installed posh-git it added some Powershell profile files, basically some .ps1 files executed each time a powershell session starts.
Just remove (or fix) them; from the path in the errors thrown probably they are in C:\Users\aymen.daoudi\Documents\WindowsPowerShell\...
I had a similar shell error message when loading my profile after installing posh-git ... profile.example.ps1 is not recognized as the name of a cmdlet.
This happened to me when I copied over files to my user directory from an older machine - the older poshgit powershell user profiles came along with it.
The fix for me was to rename the old posh-git profile from the path below...
Original Profile Path
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
New Profile Name
C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.notused
After choco uninstall poshgit and choco install poshgit a new profile was created with the right data (went from 5KB to 1KB in size).

Resources