2

First a screenshot that shows OpenSSH installed on Windows 10...

ssh

Above, I use the command ssh -V in the command prompt to make sure OpenSSH is installed.

Now.. It appears that throwing the following one liner into a .bat file to login to a linux server via ssh doesn't do anything.

ssh -p 22 [email protected]

When I type the same one liner into a windows 10 command prompt since Windows 10 now has OpenSSH built in, it logs me in just fine.

What I am missing?

suchislife
  • 4,251
  • 10
  • 47
  • 78

1 Answers1

1

Firstly, do not name your batch file ssh.bat or ssh.cmd and it will probably be best if you use the full path to the executable:

@echo off
"C:\Windows\System32\OpenSSH\ssh.exe" -p 22 [email protected]
pause

but it is probably better to use the %windir% environment variable:

@echo off
"%windir%\System32\OpenSSH\ssh.exe" -p 22 [email protected]
pause
Gerhard
  • 22,678
  • 7
  • 27
  • 43