Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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. –  Frank Thomas Dec 10 '13 at 15:10
    
@FrankThomas Can you explain it with more details? I don't know what's your point. –  Koboos Dec 10 '13 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 Dec 10 '13 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 Dec 10 '13 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 Dec 10 '13 at 18:56

1 Answer 1

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"
share|improve this answer
    
sorry for the regedit icon, re-used another shell extension I had written previously to save time. –  Knuckle-Dragger Dec 15 '13 at 14:49
    
if editing the registry directly do not include the quotes as they were created by the export to .reg file. –  Knuckle-Dragger Dec 15 '13 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 Dec 16 '13 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 ? –  Knuckle-Dragger Dec 17 '13 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 Dec 17 '13 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.