Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is command start with parameter /wait not working properly?

OK this is racking my brain!!! I have one batch file that will start another batch file but every time I run say batch file all it does is open a command window with the title being where the batch file is located. Here is the batch file that's preforming the start /wait command:

::------------------------------ configure power settings ---------------------------

@echo off

start /wait "%~d0\SETUP_POSTOP\01 Configure Power Settings\always on.bat"

::------------------------------ programs and features ------------------------------

start /wait "%~d0\SETUP_POSTOP\02 Uninstall Unwanted Software\Programs and Features.bat"

The above batch file is supposed to run "always on" batch file but all it does is open another command window. Here is the "always on" batch file its trying to start:

@echo off

echo DO NOT CLOSE!!!

%windir%\system32\powercfg.exe /import "%~d0\SETUP_POSTOP\01 Configure Power Settings\alwayson.pow" 2f5ac084-2edf-444a-b1b9-8de872cf798e

%windir%\system32\powercfg.exe /setactive 2f5ac084-2edf-444a-b1b9-8de872cf798e

start /wait %windir%\System32\powercfg.cpl

exit

I've tried everything and all my research is pointing to a bug in the start command? I'm just up in arms with this one!

like image 906
djdiag Avatar asked Oct 29 '25 01:10

djdiag


1 Answers

The start command will handle the first quoted argument as the title of the new window.

Try with

start /wait "" "%~d0\SETUP_POSTOP\01 Configure Power Settings\always on.bat"
like image 131
MC ND Avatar answered Oct 30 '25 17:10

MC ND



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!