How to access windows binary from Cygwin?

0

The path is in C:\WINDOWS\System32\OpenSSH\ssh.exe

It's an executable in Windows

C:\>dir C:\WINDOWS\System32\OpenSSH\ssh.exe

 Directory of C:\WINDOWS\System32\OpenSSH

01/01/2019  01:33 AM           891,337 ssh.exe
               1 File(s)        891,337 bytes

C:\>C:\WINDOWS\System32\OpenSSH\ssh.exe
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]]
           destination [command]

But not accessable in Cygwin with the same path.

[user@cygwin ~]$ ls -l "C:\WINDOWS\System32\OpenSSH\ssh.exe"
ls: cannot access C:\WINDOWS\System32\OpenSSH\ssh.exe: No such file or directory

Update 1

[user@cygwin ~]$ ls -l "C:\WINDOWS\System32\ipconfig.exe"
-rwxr-xr-x 2 user mkpasswd 29184 Apr 12  2018 C:\WINDOWS\System32\ipconfig.exe
[user@cygwin ~]$

[user@cygwin ~]$ ls -l "C:\WINDOWS\System32\ipconfig"
-rwxr-xr-x 2 user mkpasswd 29184 Apr 12  2018 C:\WINDOWS\System32\ipconfig
[user@cygwin ~]$

[user@cygwin ~]$ ls -l /cygdrive/c/WINDOWS/System32/ipconfig
-rwxrwx---+ 2 TrustedInstaller TrustedInstaller 29184 Apr 12  2018 /cygdrive/c/WINDOWS/System32/ipconfig
[user@cygwin ~]$

[user@cygwin ~]$ ls -l /cygdrive/c/WINDOWS/System32/ipconfig.exe
-rwxrwx---+ 2 TrustedInstaller TrustedInstaller 29184 Apr 12  2018 /cygdrive/c/WINDOWS/System32/ipconfig.exe
[user@cygwin ~]$

I was able to access most Windows binaries using both Windows () & Cygwin (/) format except for C:\WINDOWS\System32\OpenSSH\ssh.exe

[user@cygwin ~]$ ls -l /cygdrive/c/WINDOWS/System32/OpenSSH/ssh.exe
ls: cannot access /cygdrive/c/WINDOWS/System32/OpenSSH/ssh.exe: No such file or directory
[user@cygwin ~]$

[user@cygwin ~]$ ls -l "C:\WINDOWS\System32\OpenSSH\ssh.exe"
ls: cannot access C:\WINDOWS\System32\OpenSSH\ssh.exe: No such file or directory
[user@cygwin ~]$

Update 2

C:\>DIR /s/b C:\ssh.exe
C:\Windows\System32\OpenSSH\ssh.exe
C:\Windows\WinSxS\amd64_openssh-client-components-onecore_<RandomNumber1>_10.0.17134.1_none_<RandomNumber2>\ssh.exe

C:\>

user11392987

Posted 2019-07-03T10:38:29.377

Reputation: 111

Use the cygwin ssh. – DavidPostill – 2019-07-03T13:04:01.083

Thanks, but it was not found. [user@cygwin ~]$ ssh -sh: ssh: command not found [user@cygwin ~]$ – user11392987 – 2019-07-04T00:42:09.513

Answers

0

Change back slashes (\) with forward slashes (/) and replace drive letter plus colon (:) with /cygdrive/ plus lowercase drive-letter. For example:

/cygdrive/c/WINDOWS/System32/OpenSSH/ssh.exe

FedonKadifeli

Posted 2019-07-03T10:38:29.377

Reputation: 210

it works with other binaries, but not ssh.exe. I've updated my post – user11392987 – 2019-07-04T00:41:36.647

Please paste DIR /s/b C:\ssh.exe output also on your original post. – FedonKadifeli – 2019-07-04T10:32:16.713