Sn3akyP3t3 Posted May 8, 2011 Share Posted May 8, 2011 I've done output redirect with the run command, but it looks sloppy and difficult to deal with adding variables and macros to the command. This would be an example. RunWait(@ComSpec & " /c ping.exe www.google.com>""%TEMP%/pingResults.log""", @SystemDir, @SW_HIDE) Why doesn't something similar to this work? Note this command requires the devcon executable from Micro$oft which is free for download. ShellExecute(@ScriptDir & "\devcon\i386\devcon.exe", 'hwids "*" > "' & @ScriptDir & '\DevconOutput.txt"') The devcon script above runs, but does not follow the expected redirect which puzzles me. Link to comment Share on other sites More sharing options...
KaFu Posted May 8, 2011 Share Posted May 8, 2011 (edited) I would suspect that the output redirection is handled by @ComSpec / cmd.exe. ShellExecute directly calls devcon.exe, which does not recognize the redirection as a valid input parameter ... Edited May 8, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Sn3akyP3t3 Posted May 9, 2011 Author Share Posted May 9, 2011 @KaFu, I believe that is correct, but I'm not sure. I'm used to the fact that if the syntax is not correct then it will fail to run or output an error screen that is too fast to read the output of. Too bad some applications omit built in print to file or logging options as an alternative for cases like this. Scripting FFMPEG with python was another case that I ran into where my wish list just wasn't answered this year. I'll try to rewrite it as I had before with the run command until I learn a new trick that doesn't drive me mad with misplaced spaces and quotation marks! Link to comment Share on other sites More sharing options...
Sn3akyP3t3 Posted May 9, 2011 Author Share Posted May 9, 2011 I thought the temp folder had spaces in the path, but this appears to work. Perhaps it is how Windows interprets the %temp% directive that allows for it. It appears to work also for the @TempDir macro. RunWait(@ComSpec & ' /c "' & @ScriptDir & '\devcon\i386\devcon.exe" hwids * >%temp%/DevconOutput.txt', @SystemDir, @SW_HIDE) However, if spaces are clearly in the path then location of the double quote marks is paramount. RunWait(@ComSpec & ' /c ""' & @ScriptDir & '\devcon\i386\devcon.exe" hwids * >"' & @DesktopDir & '/DevconOutput.txt""', @SystemDir, @SW_HIDE) Note that this is not part of a healthy balanced diet. Thank you M$ for including and allowing spaces in default system paths! Link to comment Share on other sites More sharing options...
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