Sign in to follow this  
Followers 0
hepo

Need Help :)

7 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by xcal

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by hepo

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

The help file explains the pairing of " and ' to get around your problem when passing parameters to the run command line.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0