Jump to content

ShellExecute "<" error parameters

Recommended Posts

I need to save the execution result as a text file. Is there any solution?

ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )    if  parameters have " > " can't Execute correctly, 

Example 1:
ShellExecute("diskspd.exe", "-b128K  -c64M f:\estfile.dat > test123.txt", "", "", @SW_MAXIMIZE)  ;Error
ShellExecute("diskspd.exe", "-b128K  -c64M f:\estfile.dat", "", "", @SW_MAXIMIZE)                         ;OK

Example 2:
ShellExecute("help", "dir > helpdir.txt", "", "", @SW_MAXIMIZE)  ;Error
ShellExecute("help", "dir", "", "", @SW_MAXIMIZE)                         ;OK


Link to comment
Share on other sites

try this :-


$process=Run("help dir","", @SW_MAXIMIZE,$STDOUT_CHILD)
ProcessWaitClose($process) ;w8 the command to be executed
$Result=StdoutRead($process) ;the command output will be stored on $Result variable
MsgBox($MB_OK,"Command result",$Result) ;show the output on a msgbox
FileWrite("helpdir.txt",$Result) ; save the output in txt file


Edited by Network_Guy
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

  • Create New...