Davegbuf Posted October 26, 2018 Posted October 26, 2018 (edited) I can really used some help from someone to spot what I am doing wrong. I am working on a major project, and I need to redirect output from the built-n Windows 10 Bitlocker Manage-bde.exe to a text file. I am starting-off with a very basic example which simply displays the Bitlocker status information. Either one of these commands work perfectly fine showing you the results in the CONSOLE-TEXT.txt text file which it creates in the current directory when I run it in an elevated command window or in a batch file (run as admin). manage-bde.exe -status C: >.\CONSOLE-TEXT.txt cmd.exe /c C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt If I place the first command seen above exactly as-is into AutoIt like the following, then it does nothing: RunWait('manage-bde.exe -status C: >.\CONSOLE-TEXT.txt') If I place the second command seen above exactly as-is into AutoIt like the following, then it creates the CONSOLE-TEXT.txt file but it is completely blank: RunWait('cmd.exe /c C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt')) Other Comments I ran the commands and script from "C:\Temp" so there were no issues with spaces in the command-line This is running on Windows 10 build 1709 I tried reading the Standard output from within AutoIt but I'm not sure that I did it right or even fully understand how that all works from within AutoIt. I'm an old timer from the DOS days, so the basic ">" redirection doesn't take a lot of understanding to know what it does. Please help someone! Edited October 26, 2018 by Davegbuf
Developers Jos Posted October 27, 2018 Developers Posted October 27, 2018 9 hours ago, Davegbuf said: I'm an old timer from the DOS days, Me too. So what is now really the question here since it works when shelling the program via the cmd.exe command prompt? To me it makes sense you need the CMD.EXE command prompt when needing support to pipe the STDOUT & STDERR to a file. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Davegbuf Posted October 29, 2018 Author Posted October 29, 2018 My apologies. In re-reading my own comments, I see that I should have broken down the issue more clearly. What I meant is that I can run any of the following two commands manually from a Windows DOS/Command box or even within a batch file and they work perfectly fine. Each one produces the CONSOLE-TEXT.txt file with the results contained in it. manage-bde.exe -status C: >.\CONSOLE-TEXT.txt cmd.exe /c C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt Next, I convert either one of these "known good" commands for use in an AutoIt script as seen below but neither of them work (NOTE: I have run the script with or without #RequireAdmin ). RunWait('manage-bde.exe -status C: >.\CONSOLE-TEXT.txt') ;<--- This one does not even create the CONSOLE-TEXT.txt file RunWait('cmd.exe /c C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt')) ;<--- This one creates the text file but it is completely blank. I have even tried to run a batch file from AutoIt without any luck. Your help is much appreciated.
Developers Jos Posted October 29, 2018 Developers Posted October 29, 2018 Ok, I understand the issue now. Before telling you the issue I will tell you how I got to the conclusion: You need the CMD.exe for the piping to work so only the second command works. I then ran it as: RunWait('cmd.exe /k C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt') This left the CMD prompt open and shown the following error as you only pipe STDOUT, not STDERR:'C:\Windows\System32\manage-bde.exe' is not recognized as an internal or external command,operable program or batch file. So you are running the script with Autoit3.exe which is the x86/32bits version and it works fine with AutoIt3_x64.exe. You can add the following directive to the script in case you have the separate installer for SciTE4AutoIt3 installed: #AutoIt3Wrapper_UseX64=y RunWait('cmd.exe /c C:\Windows\System32\manage-bde.exe -status C: >.\CONSOLE-TEXT.txt') Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Davegbuf Posted October 29, 2018 Author Posted October 29, 2018 Your are totally awesome!!! That worked perfectly right from the start. I feel like printing this post and framing it on the wall. I usually install the autoit-v3-setup.exe with the "Use x86 tools by default (recommended for compatibility)" setting; and then I install the SciTE4AutoIt3 immediately afterwards. I also compile scripts as x86. Maybe I'm just being too overly cautious because I really don't know if there is the possibility of any x86 machines in our environment. Do you have any recommendations on how to install/configure my development environment going forth to avoid similar issues in the future? Maybe I should always configure for 64-bit instead no matter what. Should I be concerned? Also, for my own understanding, when you said: "in case you have the separate installer for SciTE4AutoIt3 installed ..." I do install the latest SciTE4AutoIt3 afterwards separately. Does this mean that I need to configure it differently than the default settings after I install AutoIt? I truly grateful for your assistance, and appreciate your explanation on how you arrived to the conclusion. That is very helpful for me in troubleshooting future issues. Thank you very much.
Developers Jos Posted October 29, 2018 Developers Posted October 29, 2018 You are welcome. As to your questions I have always used the x86 defaults till now, but must admit not scripting big projects anymore for more than 10 years. I just add the directive in case it need an x64 environment. Not everyone is known with the separate installer and it is required for the shown directive to work.... That's all and no need for anything else. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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