Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

Sorry that maybe I did not describe it clearly

at first I want to run the command as:C:\123\setup /i C:\123\aa.msi /qf /l* log.txt

and 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 either

I am a new one in AutoIT, hope somebody can help me

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
×
×
  • Create New...