sabina101 Posted December 3, 2009 Posted December 3, 2009 I want to run the dos command that need to run under some path, maybe there are space in the path, so I need to add quotation mark Func Install($path,$command) $setup=""""&$path&"\"&"setup"&""""&" /i " $aa=""""&$path&"\"&"aa.msi"&"""" $strcmd=$setup&$aa&StringMid($command,17) ;MsgBox(1,"a",$strcmd) _RunDOS($strcmd) EndFunc Install("C:\123","setup /i aa.msi /qf /l* log.txt") If I use MsgBox,I can get the $strcmd, if I run the $strcmd in the cmd manully,it is OK, but If I use _RunDOS($strcmd),there is no effect I want to know how to execute this _RunDos use the string with variable and quotation mark?
sabina101 Posted December 3, 2009 Author Posted December 3, 2009 in fact I want to run the command as this "C:\123\setup" /i "C:\123\aa.msi" /qf /l* log.txt Is there somebody to help me?
jvanegmond Posted December 3, 2009 Posted December 3, 2009 If you are going to call it as Install("C:\123","setup /i aa.msi /qf /l* log.txt") It's much easier to split them up in: Directory, executable and parameters. Install("C:\123\", "setup", '/i "C:\123\aa.msi" /qf /l* log.txt') Func Install($path, $exe, $param) Run('"' & $path & $exe & '" ' & $param) EndFunc And just as a friendly reminder: We would appreciate it if you give us 24 hours before you "bump" your topic. Add any additional comments in the first post, please. github.com/jvanegmond
sabina101 Posted December 4, 2009 Author Posted December 4, 2009 Sorry that maybe I did not describe it clearlyat first I want to run the command as:C:\123\setup /i C:\123\aa.msi /qf /l* log.txtand C:\123 as the path, /qf /l* log.txt as some of the commands.But maybe there are some space in the path like C:\12 3, so I need to add the quotation mark with it as : "C:\12 3\setup" /i "C:\12 3\aa.msi" /qf /l* log.txt. Because C:\12 3 is a variable $path, So I dim $setup=""""&$path&"\"&"setup"&""""&" /i " and $aa=""""&$path&"\"&"aa.msi"&"""" and $strcmd=$setup&$aa&StringMid($command,17), so I think _RunDOS($strcmd)should be OK, but it does not work, and I have tried _RunDOS('"'&$setup1&'"'&' /i '&'"'&$f9u1&'"'&StringMid($command,17)), _RunDOS('"'&$setup1&'"'&" /i "&'"'&$f9u1&'"'&StringMid($command,17)) they are not work eitherI am a new one in AutoIT, hope somebody can help me
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