2013-04-16 85 views
1

我正在使用以下腳本從Linux連接到Windows服務器,但連接後,我必須通過執行一個位於D下的位置的命令:Windows驅動器然後是一些文件夾(其中文件夾名稱由空格組成,例如:d:\ Rakesh Tatineni \無法執行\ Manager.exe 1 1)無法通過連接通過Linux在Windows服務器上調用命令

以上是我想要執行/調用一個命令2論點11.

腳本用來連接到窗戶

#!/usr/bin/expect -f 
# Expect script to supply username/admin password for remote ssh server 
# and execute command. 
# This script needs three argument to(s) connect to remote server: 
# password = Password of remote Windows server, for Windows user. 
# For example: 
# ./call_engine.sh password 
# set Variables 
set password [lrange $argv 0 0] 
set timeout -1 
# now connect to remote windows box (ipaddr/hostname) with given script to execute 
spawn ssh [email protected]<WindowsserverName> 
match_max 100000 
# Look for passwod prompt 
expect "*?assword:*" 
# Send password aka $password 
send "$password\r" 
# send blank line (\r) to make sure we get back to gui 
send "\r" 
expect eof 

感謝您的幫助,在兩者之間有什麼樣的代碼,我們必須包括正如我上面提到調用命令「d:\拉克什Tatineni \不能執行\的manager.exe 1 1」

謝謝, 拉克什T

回答

0

我看到你已經給腳本一個密碼的參數。所以你可以改變你的腳本slighlty添加兩個像這樣的參數:

set password [lrange $argv 0 0] 
set arg1 [lrange $argv 1 1] 
set arg2 [lrange $argv 2 2] 
相關問題