chenni037 Posted June 30, 2020 Posted June 30, 2020 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 T1.au3
Network_Guy Posted June 30, 2020 Posted June 30, 2020 (edited) try this :- #include<AutoItConstants.au3> #include<MsgBoxConstants.au3> $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 June 30, 2020 by Network_Guy chenni037 1
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