Solved

SSH from AIX to windows server and run a windows batch script.

Posted on 2009-04-02
3
697 Views
Last Modified: 2013-11-17
I need to run a script from an AIX server that logs into a Win 2003 server and runs a windows batch script.

I tried testing this via command line (still need to work out the ssh key so i don't need pw, but thats ok for now) When I run the below command and login, its removing the \ from the runline and not finding the script i am trying to run.

example:
ssh user@10.10.1.1 "C:\scripts\winbat.bat"
C:scriptswinbat.bat: not found

0
Comment
Question by:jamison_fox
  • 2
3 Comments
 

Author Comment

by:jamison_fox
ID: 24053962
Actually, I figured this out., I needed to reverse the slash, and make them double. This did the trick.

ex: ssh user@10.10.1.1 "C://scripts//winbat.bat"
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 125 total points
ID: 24054027
Hi,
you will have to double-escape the backslashes,
so use:

ssh user@10.10.1.1 "C:\\\scripts\\\winbat.bat"

or use strong quotes with single escapes:

ssh user@10.10.1.1 'C:\\scripts\\winbat.bat'

The backslashes have special meanings and must be protected from being processed by the shells.

It might be that with Windows as a target system single escapes (\\) might be sufficient. Try it!

wmp


0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24054066
OK, too late ...
Glad you found it!

Seems that with Windows the slashes have only to be protected from the sending shell. The target 'cmd' window will obviously not try to process them.

wmp

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 80
firstswap challenge 20 68
Hide vba in gp 7 83
PowerShell one liner to pull server names 3 52
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Learn about cloud computing and its benefits for small business owners.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now