Powershell and CMD can't find any builtin commands [closed] - windows

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
I'm unable to use any common commands in windows cmd or powershell. For every command I get this error:
ssh: The term 'ssh' is not recognized as a name of a cmdlet, function, script file, or executable program.
Or:
ipconfig: The term 'ipconfig' is not recognized as a name of a cmdlet, function, script file, or executable program.
The ssh.exe is present though, so it may be an issue with wrong paths. I checked system variables and everything seems fine. What could be the issue here?

Check the environment variables such as %PATH% and %COMSPEC%. Most likely, there is a problem with %PATH% and it is missing some default directories that it usually contains.
Also try running sfc /scannow.
AFAIK, %PATH% by default includes these directories:
C:\Windows;
C:\Windows\System32;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0
But this can change from system to system and perhaps Windows versions. Software you install on Windows may change %PATH% and add new directories into it.

Related

How to use program name with out specific path in .cmd file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
When I usually type following command in command prompt,
pageant "C:\Users\test\.ssh\id_rsa.ppk"
It have worked well.
But on the other hands,when I make test.cmd file like
pageant "C:\Users\test\.ssh\id_rsa.ppk"
And then double click, it didn't work
buttest.cmd in following script
"C:\Program Files\PuTTY\pageant.exe" "C:\Users\test\.ssh\id_rsa.ppk"
work well.
What is the different between them ?
I guess The path was recognized by cmd.
If someone has opinion, please let me know
If the command doesn't contain an absolute path and isn't an internal command then cmd.exe will find the executable in the current folder and then look in the folders in the %PATH% environment variable. It looks like the current folder in your cmd is C:\Program Files\PuTTY so pageant can be found and execute normally. If you cd to a different folder then it won't work unless the folder exists in %PATH%

windows Runas always returns "The System cannot find the file specified" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
Windows runas.exe application does not work when I use the same syntax shown in runas /?. For example one of the usages shown is, runas /trustlevel<TrustLevel> program, however, when I use runas /trustlevel<0x20000> calc I get "The system cannot find the file specified." What file is it talking about?
I noticed another person asked similar question but they were trying to use console program written using Delphi: Got "The system cannot find the file specified" when I run NETSH from CreateProcess but it works ok on Command Prompt?
but I am using DOS command in Windows so I don't understand why the same command would run fine if I type in command prompt or Start Menu->Run or Taskmanager->File->Run but won't work when I use runas.
< and > is the input and output redirection operators in cmd.exe. /trustlevel<0x20000> is asking cmd.exe to read from a file called 0x20000.
The correct syntax is runas /trustlevel:0x20000 calc.
The <something> syntax in help output means the parameter is required. [something] is optional.
/trustlevel does not change the UAC integrity level so it is not a good way to reduce your rights although it will add a deny-only SID for the administrators group so it is probably implemented with the Safer API.

Where is "xcopy" usually located on a development machine? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have a build process that needs to use xcopy. I am getting an error, and I want to make sure that it is finding the command ok.
But google is not helpful when searching for where xcopy would be located on my (or my build) machine.
What is the file path to XCOPY?
Usually %WINDIR%\system32 e.g. C:\Windows\system32.
Be aware that on a 64-bit machine, there's some magic going on with the result that what appears to be C:\Windows\system32 is actually C:\Windows\SysWOW64. However for your purposes I don't believe this should matter.
xcopy.exe is located under C:\Windows\system32\xcopy.exe. There also exists a 32-bit version under C:\Windows\SysWOW64\xcopy.exe if you're running an x64 version of Windows.
The following command line show where the xcopy.exe file is located so it is equivalent to where xcopy.exe command, but it works in any Windows version:
for %a in (xcopy.exe) do #echo %~$path:a
If you really want it to be accurate, you should use the same method Windows uses to load an executable.
Where is a 3rd-party utility including source, that has an excellent explanation of how Windows locates an executable, dll, etc. It also matters whether you run it via ShellExec or CreateProcess

custom commands / keyword in command prompt [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
This has to be a very simple question... but as long as i can remember i've seen special keywords or commands in the windows command prompt which are clearly not system commands like dir cd etc
Today i was reminded of this using node.js and from the command prompt I cd'd into a director and typed "npm install".
My question is simple... how does the keyword/command "NPM" get associated with a corresponding exe or other "command handler"? I would think this is very basic but after searching through the internet, its surprisingly hard to find the explanation.
E.g. how could i associate "stack /overflow" with some kind of process/exe that would be able to parse out the "overflow" variable.
A command line interpreter has a number of built-in functions (your examples of "cd", "dir" etc.). For all other input it:
looks in the current folder
looks in the current PATH folders
to see it finds a matching command with an executable file extension, such as ".exe", ".com", and ".bat". The system wide variable PATH holds a list of folders to search in.
If you write a program called "stack", it will typically be called "stack.exe" in full, and be put wherever your programming environment outputs binaries. Then you can
use cd to navigate to that folder and type stack to call it
use the full path specification from any other folder, such as c:\Users\Documents\MyOwnsoftware\Stack\Release\stack
copy stack.exe into one of the folders that is already scanned through the PATH variable
add the folder containing stack.exe to your PATH.
As you can see, these solutions all comply to the look-up order above.

Cannot find cygwin directories in Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using cygwin to learn BASH scripting inside windows. I created a directory /mystuff/unixstuff. I tried searching for this unixstuff directory in windows, but I cannot find it. Where does cygwin create files and folders ?
Cygwin's root (/) directory is wherever you tell setup.exe to put it when you first install Cygwin.
I think the default is C:\cgywin. I've also used D:\cygwin.
You can use the cygpath command from the Cygwin bash shell to tell you. I'm not on my Cygwin system at the moment, but I think cygpath -w / will show you the Windows path of the Cygwin root, and cygpath -w /mystuff/unixstuff should tell you the Windows path to your /mystuff/unixstuff directory.
BTW, the usual convention for Unix-like systems (including Cygwin) is to put your own files under your home directory. Putting things directly under the root, as you've done with your /mystuff directory, risks interfering with system files. (Your home directory is probably /home/username, or in Windows something like C:\cygwin\home\username.)

Resources