Solved

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

752 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