Request: for "Awake" tool, offer to set the "--pid" argument to be set to the current process
Description of the new feature / enhancement
For this: https://docs.microsoft.com/en-us/windows/powertoys/awake#command-line-interface-cli
I've noticed there is an option of attaching it to a process, that as long as the process is alive, let the "Awake" be enabled (and then stop). I want to set it to the current process.
Scenario when this would be used?
Supposed I create a batch file that I want to run and let it keep working fine (without having the OS to turn off anything of the PC and breaking the execution), I want to be able to tell "Awake" to be attached to this execution process.
Supporting information
No response
I would love to have an option where I can configure a process like ffmpeg.exe and awake is enabled as long as the process is running
I'd love to understand the use case better here. What do you mean by "current process"? The way I am thinking your current steps should be:
- Start whatever process you have in mind.
- Acquire PID.
- Pass PID to Awake.
Is that not the case?
I guess he just means the parent process. so that the PID must not be looked up.
here is a .bat-file that should keep system awake for 10 seconds
start "c:\Program Files\PowerToys\modules\Awake\PowerToys.Awake.exe" --parent
timeout 10
@AndroidDeveloperLB @greuelpirat heads-up that this is coming in the next release of Awake.
Released in the latest PowerToys.
@dend I just tried it, but I could not get it to work:
test.bat:
PowerToys.Awake.exe --use-parent-id
echo %ERRORLEVEL%
timeout /t 5 /nobreak
output:
C:\Temp>test.bat
C:\Temp>PowerToys.Awake.exe --use-parent-id
C:\Temp>echo 1
1
C:\Temp>timeout /t 5 /nobreak
there is no active Awake-Process during the 5 seconds. Do you have any suggestions? It would be great! Thank you!
(File version of PowerToys.Awake.exe is 0.84.0.0)
@greuelpirat - the problem is you have a typo - it should be --use-parent-pid (pid is the keyword). That being said, if you just use the exe file launch like that, it will hold up the rest of the script. Here is what I use for testing:
start "" "DISK:\SOURCE_FOLDER\PowerToys\x64\Debug\PowerToys.Awake.exe" --use-parent-pid
if %ERRORLEVEL% neq 0 (
echo Error occurred while running the program.
echo %ERRORLEVEL%
) else (
echo Program executed successfully.
)
timeout /t 5 /nobreak
@dend you are right! I am sorry, it works now. Thank you very much! 😄