Solved

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

Posted on 2009-04-02
3
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Learn about cloud computing and its benefits for small business owners.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

740 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