- echo @echo off>56.bat
- echo setlocal EnableDelayedExpansion>>56.bat
- echo for /f "tokens=2 delims=()" %%%%i in ('powercfg -getactivescheme') do ( >>56.bat
- echo set a=%%%%i >>56.bat
- echo if "!a!" EQU "Balanced" powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c >>56.bat
- echo if "!a!" EQU "High performance" powercfg -setactive a1841308-3541-4fab-bc81-f71556f20b4a>>56.bat
- echo if "!a!" EQU "Power saver" goto end)>>56.bat
- echo :end>>56.bat
复制代码 上述语句得到的56.bat- @echo off
- setlocal EnableDelayedExpansion
- for /f "tokens=2 delims=()" %%i in ('powercfg -getactivescheme') do (
- set a=%%i
- if "!a!" EQU "Balanced" powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
- if "!a!" EQU "High performance" powercfg -setactive a1841308-3541-4fab-bc81-f71556f20b4a
- if "!a!" EQU "Power saver" goto end)
- :end
复制代码 为什么不能执行?不知到问题出在哪,求高手指教~~
ps:单独新建批处理可以正确执行~ |