0

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;
};
2
  • I think, parameters are not part of this argument as it presents executable. – Qwertiy Jul 16 '18 at 11:45
  • @Qwertiy Any idea how else I could start my command? – Stefan Falk Jul 16 '18 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.