How to make a toggle switch in batch file ?
Go to solution
Solved by Jacques Cartier,
18 minutes ago, badreg said:Read the current priority and use a conditional statement to switch to the other condition.
set processName=ScpService.exe set "WMIC_CMD=wmic process where name^='%processName%' get /format:list ^| findstr Priority" for /f "tokens=1* delims==" %%A in ('%WMIC_CMD%') do set priority=%%B if %priority% == 8 ( wmic process where name^="%processName%" CALL setpriority "high priority" ) else ( wmic process where name^="%processName%" CALL setpriority "normal" )
Thank you very much ! It's working. I asked my question on tomshardware and 10forum. Someone told me It wasn't possible, another one suggest a script 100 times bigger. Thank you for your help, it's really appreciated.
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