Solved

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

Posted on 2009-04-02
3
698 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can’t delete a file 14 161
Linux hostname change 2 70
draw a Christmas tree by using a nested loop? 26 61
object oriented design (python) and documentation tools 2 35
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.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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…

813 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

12 Experts available now in Live!

Get 1:1 Help Now