Jump to content

Need help with Run function


Recommended Posts

Hi,

I created an autoit console application that supposed to run a command line utility program named mdrv.exe

I am facing problem due to syntax of the command string probably because of spaces in the path.

The utiliti is:

$Mdrv = C:\Program Files (x86)\HP\Virtual User Generator\bin\mdrv.exe

The command line arguments are:

$USR = "-usr C:\Users\Scripts\Some folder\test.usr"

$Results = "-out c:\Some Folder\Results Folder"

The syntax of the command line:

mdrv.exe -usr <Path to .usr file> -out <Path to results folder>

I tried something like this but its always fails due to spaces in the path. Please see the Run command bellow

$STR = " /c "  &  $Mdrv  & " -usr "  & $USR & " -out " & $Results
$STR = String($STR)
consolewrite($STR &  @CRLF)
 $foo =Run( @ComSpec & $STR, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
;Consolewrite ($foo & @CRLF)


    Local $line
    While 1
        $line = StdoutRead($foo)
        If @error Then ExitLoop
        ConsoleWrite($line)
        WEnd
    While 1
        $line = StderrRead($foo)
        If @error Then ExitLoop
        ConsoleWrite(@CRLF & @CRLF & $line)
    WEnd

EndFunc

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

Hi lsakizada,

maybe you want to use another type of quotes. Try:

Run(@ComSpec & " /c 'C:\Program Files (x86)\HP\Virtual User Generator\bin\mdrv.exe' -usr 'C:\Users\Scripts\Some folder\test.usr' -out 'c:\Some Folder\Results Folder'", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi lsakizada,

maybe you want to use another type of quotes. Try:

Run(@ComSpec & " /c 'C:\Program Files (x86)\HP\Virtual User Generator\bin\mdrv.exe' -usr 'C:\Users\Scripts\Some folder\test.usr' -out 'c:\Some Folder\Results Folder'", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

Not works for me.

I use the following command:

$foo = Run(@ComSpec & " /c 'C:\Program Files (x86)\HP\Virtual User Generator\bin\mdrv.exe' -usr 'C:\Users\ascqauser\Desktop\vUgen Scripts\Leonid Scripts for BSRM\FLEX_WORKING\FLEX_WORKING.usr' ", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

and the console display the message:

The file name, directory name, or volume label syntax is incorrect

I am actually want to use the parameters that presents the cmdline arguments and the utility.

Be Green Now or Never (BGNN)!

Link to comment
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
 Share

  • Recently Browsing   0 members

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