schmelle Posted December 21, 2008 Share Posted December 21, 2008 (edited) Hi all, I'm trying to simulate a puTTY session with plink.exe. It works fine if the path to plink.exe does not contain any spaces. If the path contain any spaces I got an "File not found" error. Does anybody has an idea how to avoid this using the @WorkingDir macro? $Connection = Run(@WorkingDir&"\"&$plink_exe&" -ssh -auto_store_key_in_cache -l "&$UserI&" -pw "&$PassI&" "&$HostI, @WorkingDir,@SW_HIDE, $STDIN_CHILD + $STDERR_CHILD + $STDOUT_CHILD) Thanks and best regards schmelle P.S.: I'm using plink.exe from QuestpuTTY which supports the parameter "-auto_store_key_in_cache". Edited December 21, 2008 by schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2008 Developers Share Posted December 21, 2008 Why are you adding the working dir? I would expect that to be redundant and would think you could only use $plink_exe for the programname. The normal option I would go for when it is needed is to surround the programname with DoubleQuotes and probably in this case also use @comspec. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
schmelle Posted December 21, 2008 Author Share Posted December 21, 2008 Hi Jos, thanks for your reply. I'm not exaktly sure what you mean with your first sentence. My problem is that I don't know where the user will store the script. The location of the script (and plink.exe) can contain spaces... I've modified the script as you requestet to: $Connection = Run(@ComSpec&" /c "&@WorkingDir&"\Data"&"\plink.exe"&" -ssh -auto_store_key_in_cache -l "&$UserI&" -pw "&$PassI&" "&$HostI, @WorkingDir,@SW_HIDE, $STDIN_CHILD + $STDERR_CHILD + $STDOUT_CHILD) Same Problem. If the location of plink.exe contains a space, plink.exe won't be found (and not started). schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2008 Developers Share Posted December 21, 2008 (edited) I do not understand why @workdir is needed as that is already the current directory so this: @WorkingDir&"\Data"&"\plink.exe" should be the same as: "plink.exe" When you do need the whole path I would add double quotes around it like: $Connection = Run(@ComSpec & ' /c "' & @WorkingDir & '\Data\plink.exe" -ssh -auto_store_key_in_cache -l ' & $UserI & ' -pw ' & $PassI & ' ' & $HostI, @WorkingDir, @SW_HIDE, $STDIN_CHILD + $STDERR_CHILD + $STDOUT_CHILD) Edited December 21, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
schmelle Posted December 21, 2008 Author Share Posted December 21, 2008 Hi Jos, great! It's working as expected! Now I understand what you meant and modified the string a little bit to match your first sentence: $Connection = Run(@ComSpec&" /c "&".\Data\plink.exe"&" -ssh -auto_store_key_in_cache -l "&$UserI&" -pw "&$PassI&" "&$HostI, @WorkingDir,@SW_HIDE, $STDIN_CHILD + $STDERR_CHILD + $STDOUT_CHILD) Thanks for your help schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now