I am trying to write a batch script that changes the window scheme.
The problem seems that something goes wrong. The script prints:
Invalid format.
Hint: <paramlist> = <param> [, <paramlist>].
As I run:
@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%
If I set command=notepad.exe
, the script works fine. I am assuming that I am formatting the command
parameter wrong but I can't figure out what it takes to make this interpretable.
Just running the following does seem to work:
> 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;
};
but just adding Control_RunDLL
as a parameter seems to cause a problem:
> 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;
};
command
?