我正在尝试编写一个改变窗口方案的批处理脚本。
问题似乎出了问题。脚本打印:
Invalid format.
Hint: <paramlist> = <param> [, <paramlist>].
当我跑步时:
@echo off
set "command=rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:\C:\Windows\Resources\Themes\aero.theme\"
set pid=0
for /f "tokens=2 delims==; " %%a in ('wmic process call create "%command%"^,"%~dp0." ^| find "ProcessId"') do set pid=%%a
echo %pid%
timeout 2
taskkill /pid %pid%
如果我设置了command=notepad.exe
,脚本就可以正常工作。我假设我command
错误地格式化了参数,但我不知道如何才能使其可解释。
只需运行以下命令似乎就可以工作:
> wmic process call create "rundll32.exe %SystemRoot%\shell32.dll"
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ProcessId = 10980;
ReturnValue = 0;
};
但仅仅添加Control_RunDLL
一个参数似乎会导致问题:
> wmic process call create "rundll32.exe %SystemRoot%\shell32.dll,Control_RunDLL"
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = 9;
};