hepo Posted October 7, 2006 Posted October 7, 2006 Hello, I' am trying to run dos commands and have problem with puting " in paths. I' am doing something like this: Run("cmd.exe" & " /k" & ""D:\Program Files\7-Zip\7z.exe"" & "a" & "-tgzip" ""\\server\arhive.zip"" & ""\\server\folder\*"") I' am getting this 'D:\Program' is not recognized as an internal or external command, operable program or batch file. When I run only this Run("cmd.exe" & " /k" & ""D:\Program Files\7-Zip\7z.exe"") It's all good. Help please
xcal Posted October 7, 2006 Posted October 7, 2006 (edited) Why are you cutting this all up in to pieces if you're not using a variable? ""D:\Program Files\7-Zip\7z.exe"" & "a" & "-tgzip" ""\\server\arhive.zip"" & ""\\server\folder\*"" Anyway, I think you're supposed to be using @comspec for this sort of stuff. edit - Maybe something like... Run(@ComSpec & ' /k D:\Program Files\7-Zip\7z.exe a -tgzip "\\server\arhive.zip" "\\server\folder\*"') Edited October 7, 2006 by xcal How To Ask Questions The Smart Way
hepo Posted October 7, 2006 Author Posted October 7, 2006 @comspec is a system variable to cmd.exe - it's the same thing. You'r way returns the same error. I'll try with variables. Thanks.
The Kandie Man Posted October 7, 2006 Posted October 7, 2006 Run(@ComSpec & ' /k "D:\Program Files\7-Zip\7z.exe" a -tgzip "\\server\arhive.zip" "\\server\folder\*"') No? "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
hepo Posted October 7, 2006 Author Posted October 7, 2006 (edited) Check thi out When I run this: $soft='"D:\Program Files\7-Zip\7z.exe"' $path1=' \\ro\Storage\tmp\aaaa.zip' $path2=' \\ro\Storage\tmp\bg\' Run(@ComSpec & ' /k' & $soft & ' a' & ' -tzip' & $path1 & $path2)oÝ÷ ØâºÜ»§¶¬jëh×6$soft='""D:\Program Files\7-Zip\7z.exe"' $path1=' ""\\ro\Storage\tmp\Roger Sanchez\aaaa.zip"' $path2=' \\ro\Storage\tmp\bg\' Run(@ComSpec & ' /k' & $soft & ' a' & ' -tzip' & $path1 & $path2)oÝ÷ Ù8^¢ên¶+¡×jw!{>|XM ѹñ8^³+-zgz-~)ݶW¬¥ç"~'RZ¶)àj·!÷´÷m=Úº4÷d¢¶ {Ov¶jt÷dhêó¨Þ²È§¸¢jkzË"àÓÝH#xãmc¦¨Þ²È§¸4÷`ÒÞ8Ûhé*&¦·¬²)àn =Ø476Þ:`I©Üìùñ8^³+-zgz-~)ݶW¬¥ç"~'ß}÷ß}÷ß}÷ß}÷ß}÷ýÊx¯z{kÊØb±«¢+ØÀÌØíͽÐÅ|ÄôÌäìÅÕ½ÐíèÀäÈíAɽɴÌäì(ÀÌØíͽÐÅ|ÈôÌä쥱ÌÀäÈìܵi¥ÀÀäÈìÝè¹áÅÕ½ÐìÌäì(ÀÌØíÁÑ Å|ÄôÌäìÅÕ½ÐìÀäÈìÀäÈíɼÀäÈíMѽÉÀäÈíѵÀÀäÈíI½ÈÌäì(ÀÌØíÁÑ Å|ÈôÌäìM¹¡èÀäÈí¹é¥ÀÅÕ½ÐìÌäì(ÀÌØíÁÑ ÈôÌäìÀäÈìÀäÈíɼÀäÈíMѽÉÀäÈíѵÀÀäÈíÀäÈìÌäì)IÕ¸¡ ½µMÁµÀìÌä콬ÌäìµÀìÀÌØíͽÐÅ|ĵÀìÀÌØíͽÐÅ|ȵÀìÌäìÌäìµÀìÌäìµÑé¥ÀÌäìµÀìÀÌØíÁÑ Å|ĵÀìÀÌØíÁÑ Å|ȵÀìÀÌØíÁÑ È Did not help. I need some one to explain me how this "" works cause I dont unerstand a thing Thanks Edited October 7, 2006 by hepo
The Kandie Man Posted October 7, 2006 Posted October 7, 2006 Sometimes i have problems like this as well. Try writing the command line to a bat file via FileWriteLine(). Once you do that, have autoit run the bat file and then the bat file will run the program that you want to run. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
Confuzzled Posted October 7, 2006 Posted October 7, 2006 The help file explains the pairing of " and ' to get around your problem when passing parameters to the run command line.
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