iXX Posted January 1, 2014 Share Posted January 1, 2014 Hi! I have trouble with this command to work (running command line utility): RunWait(@COMSPEC & ' /c ' & '"C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces "D:\Bla Bla\File.Bin" > D:\BLE\aa.txt', "", @SW_HIDE)In Windows cmd.exe, this works:C:>"C:Program Files (x86)ReHashReHash.exe" -None -SHA256 -Out:NoSpaces "D:Bla BlaFile.Bin" > D:BLEaa.txt I believe this is the same, syntax should be OK, so why it dont work?? Thanks for Your time! Link to comment Share on other sites More sharing options...
BrewManNH Posted January 1, 2014 Share Posted January 1, 2014 First, change /c to /k to keep the console window open, second lose the @SW_HIDE until you find out what your error is. Third, change the RunWait to ConsoleWrite and just have it print out the command you're using to see if it is identical to the manually entered line. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2014 Share Posted January 1, 2014 also, try to run your command directly (without cmd) like this: RunWait('"C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces "D:\Bla Bla\File.Bin" > D:\BLE\aa.txt', "", @SW_HIDE) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
orbs Posted January 1, 2014 Share Posted January 1, 2014 also, try to run your command directly (without cmd) like this: RunWait('"C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces "D:\Bla Bla\File.Bin" > D:\BLE\aa.txt', "", @SW_HIDE) @PincoPanco, the use of comspec is required for the output redirection (or at-least that's what my tests indicate). @iXX, in addition to what BrewManNH suggests, it would be helpful if you can tell what is the indication for failure: - do you get an error message? - what is the return value of RunWait()? - what is the value @error? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2014 Share Posted January 1, 2014 maybe something to do with the "File System Redirection"Take a look >here and >here Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
BrewManNH Posted January 1, 2014 Share Posted January 1, 2014 It probably has something to do with the environment that the script is running in, as PincoPanco said, but hiding everything like that runwait command does, means no one will know. Which is why I always tell people having these issues is to never run hidden or with /c until they get it running. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
iXX Posted January 1, 2014 Author Share Posted January 1, 2014 So I tested: - Change @ComSpec from ' /c ' to ' /k ' -> no change. + Remove @SW_HIDE -> console window opens and there something like "Program not name of in or out command, program or bat" (my bad translate to english, i hope you understand it). - Then I change to ConsoleWrite: ConsoleWrite(@ComSpec & ' /k ' & '"C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces "D:\Bla Bla\File.Bin" > D:\BLE\aa.txt') Here is out: >"C:Program Files (x86)AutoItSciTE..autoit3.exe" /ErrorStdOut "D:AU3hash.au3" C:\Windows\System32\cmd.exe /k "C:Program Files (x86)ReHashReHash.exe" -None -SHA256 -Out:NoSpaces "D:Bla BlaFile.Bin" > D:BLEaa.txt>Exit code: 0 Time: 0.210 It looks identical. - Running without @ComSpec as PincoPanco suggests -> no luck. - Running my original code is without error message (exit code 0). - The return value of my original code is 1, the @Error is 0. - With @ComSpec ' /k ' the return value is -1073741510, @Error is 0. - Only working "solution" I found = make a .BAT file with this content: "C:Program Files (x86)ReHashReHash.exe" -None -SHA256 -Out:NoSpaces "D:Bla BlaFile.Bin" > D:BLEaa.txt ... and RunWait("ThisBATfile"). It is solution like pig! - With File System Redirection I am not familiar, need study. If someone want to try this, the utility can be downloaded here: http://rehash.sourceforge.net/ Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2014 Share Posted January 1, 2014 try using quotes in this way and it should work: RunWait(@COMSPEC & ' /c ""C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces D:\Bla Bla\File.Bin > D:\BLE\aa.txt"', "", @SW_HIDE) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Solution iXX Posted January 1, 2014 Author Solution Share Posted January 1, 2014 try using quotes in this way and it should work: RunWait(@COMSPEC & ' /c ""C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces D:\Bla Bla\File.Bin > D:\BLE\aa.txt"', "", @SW_HIDE) Dont work, BUT! I add two more quotes to "D:Bla BlaFile.Bin" - because there is a space in the path, AND IT WORKS!! RunWait(@COMSPEC & ' /c ""C:\Program Files (x86)\ReHash\ReHash.exe" -None -SHA256 -Out:NoSpaces "D:\Bla Bla\File.Bin" > D:\BLE\aa.txt"', "", @SW_HIDE) THANKS A LOT for help! SOLVED. Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2014 Share Posted January 1, 2014 ... ah right! also are needed quotes around source and destination filenames if there are spaces in the path .... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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