我找到了一个包含所有Windows命令的列表。 命令如:ms-settings:batterysaver-settings。 当我将“start”放在它们前面时,我可以在cmd中打开这些命令。 命令如:start ms-settings:batterysaver-settings。 但我想改变电池的价值而不是打开它是否可以做到?
答案 0 :(得分:0)
也许将参数发送到批处理文件。这是一个例子,稍微详细一点,为您提供扩展的想法。示例用法可能是 OpenWindowsSettings.bat printers
。
@echo off
rem Open one of the Windows Settings pages
setlocal EnableDelayedExpansion
rem Count arguments and place them in an array
set argCount=0
for %%x in (%*) do (
set /a argCount += 1
set "argVec[!argCount!]=%%~x"
)
rem Any parameters and can we act on them?
set argProcessed=0
if %argCount% GTR 0 (
rem One or more arguments were supplied...use the first one only
if !argVec[1]! EQU printers (call :ShowPrinters)
if !argVec[1]! EQU batterysaver-settings (call :ShowBatterySaverSettings)
if !argProcessed!==0 (echo No parameters recognised...try sending "printers")
) else (
echo No parameters passed...try sending "printers"
)
rem All done, bye!
goto :EOF
:ShowPrinters
rem Show Windows Settings > Devices > Printers & scanners
set /a argProcessed += 1
start ms-settings:printers
exit /b 0
:ShowBatterySaverSettings
rem Show Windows Settings > System > Battery
set /a argProcessed += 1
start ms-settings:batterysaver-settings
exit /b 0
您可以找到一长串 ms-settings
here 的选项。