Reputation: 1153
I set a new environment variable but I cannot execute.
Below is an example from my command line trying to call ssh
.
ssh
is installed correctly and I can execute it fine from the command line when I am in its path. But I cannot call it anywhere else, though I have set the environment variable for it.
From the command line...
// showing that the ssh environment variable is set
(base) C:\Users\ooo>echo %ssh%
C:\Windows\System32\OpenSSH-Win64\ssh.exe
// Though I can't call it from here
(base) C:\Users\ooo>ssh
'ssh' is not recognized as an internal or external command,
operable program or batch file.
// Not with `ssh` and not with `ssh.exe`
(base) C:\Users\ooo>ssh.exe
'ssh.exe' is not recognized as an internal or external command,
operable program or batch file.
// I cd into the path `ssh.exe` resides
(base) C:\Users\ooo>cd C:\Windows\System32\OpenSSH-Win64\
// and only then can I run `ssh`
(base) C:\Windows\System32\OpenSSH-Win64>ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
[-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
I have the ssh envirsonment variable set for the user and for the system.
I have tried just setting it for one or the other and both. I always have the same problem as above. It's as if there is absolutely no environment variable set.
I have this problem with any environment variable I need to set. Some commands install their own variables, which work fine on the command line but I cannot set my own for some reason.
Upvotes: 3
Views: 5844
Reputation: 306
When you type ssh
Windows searches all directories in the PATH
environment variable to look for something to execute, like ssh.exe
, ssh.com
, ssh.bat
, ...
I think the directory C:\Windows\System32\OpenSSH-Win64
is not in your path and so Windows doesn't find your ssh.exe
.
You can e.g.
PATH
environment variable%ssh%
(or better "%ssh%"
) instead of just ssh
Upvotes: 1