Jump to content

Recommended Posts

Posted

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

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
Posted

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

Posted

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

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
Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...