0

I have a touch button in my laptop which I can configure what app it will open after touching it.

I edit a path to program in registry. When there is some .exe file (i.e. notepad.exe) everything works fine. But when I'm trying to put "rundll32.exe" with parameters to sleep windows it doesn't want to work. I put the following line:

rundll32.exe powrprof.dll,SetSuspendState Sleep

I checked another exe file with parameter"

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito

And it is working. But how to run rundll32.exe with these parameters? In Command Prompt I put the above command after executing computer goes to standby mode so I assume the parameters are correct. The problem is how to execute this command from registry (by touching button). Maybe there's a special syntax for registry commands that I'm not aware of

10
  • it may be that it only supports POSIX compliant parameters like your chrome one, but my guess is that you need to adjust your quoting to account for parameters for your dll vs parameters for rundll32. Commented Dec 10, 2013 at 15:10
  • @FrankThomas Can you explain it with more details? I don't know what's your point.
    – Koboos
    Commented Dec 10, 2013 at 17:14
  • @Koboos - You should update your question with that information so my comment can be deleted. The next step is to create a working shortcut. Once you have that working we can go to the next step in trying to determine whats wrong with what you have currently.
    – Ramhound
    Commented Dec 10, 2013 at 17:53
  • @Ramhound I created shourtcut on desktop. On double-clicking, computer goes to stanby mode. I know there is a way to create batch file and point to this file in registry, but I want to know how to make this working without additional files.
    – Koboos
    Commented Dec 10, 2013 at 18:10
  • @Koboos - At this point you have a working shortcut. You also know the command works by running the shortcut. Create yourself a .bat file and instead of running Chrome run the .bat file. Since you don't want to do that, provide the full path to rundll32.exe, this should allow it to work.
    – Ramhound
    Commented Dec 10, 2013 at 18:56

1 Answer 1

0

Try this from your tablet's button key.

"cmd /c start /wait /b rundll32.exe powrprof.dll,SetSuspendState Sleep"

Tested and working from Registry based command interpreter by yours truly. (on 2012-R2 server).

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\SLEEPYTIME]
"MUIVerb"="SLEEPYTIME"
"icon"="regedit.exe"
"Position"="Top"
"HasLUAShield"="1"

[HKEY_CLASSES_ROOT\Directory\Background\shell\SLEEPYTIME\command]
@="cmd /c start /wait /b rundll32.exe powrprof.dll,SetSuspendState Sleep"
5
  • sorry for the regedit icon, re-used another shell extension I had written previously to save time. Commented Dec 15, 2013 at 14:49
  • if editing the registry directly do not include the quotes as they were created by the export to .reg file. Commented Dec 15, 2013 at 14:54
  • Still not working. I've put your command without quotes into REG_SZ named QAction, but it doesn't sleep laptop on touching button.
    – Koboos
    Commented Dec 16, 2013 at 10:26
  • I don't know how the hardware button software is implementing it's command, does it work when you create a batch file ? Commented Dec 17, 2013 at 7:32
  • When I put a path to bat or vbs file (with a proper command in it) everything works fine. Probably I'll stick with this solution because it does the job, but I still don't understand why some commands works in registry and some not.
    – Koboos
    Commented Dec 17, 2013 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .