Jump to content

Customised keyboard short cut to activate batch file not working


Recommended Posts

Guest redyellowgreenblue@gmail.com
Posted

Hi

 

I've set-up a batch file to automatically hibernate my computer (the

code is "RUNDLL32.EXE PowrProf.dll,SetSuspendState").

 

I've then created a shortcut to this on the desktop, and assigned it

the keyboard shortcut CTRL+ALT+H using the /Properties/Shortcut

option.

 

But it doesn't work. Actually, it worked once, but then never again.

I've tried it with no other programs running, but no luck.

 

Should customised keyboard short cuts work to activate batch files?

  • Replies 2
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: Customised keyboard short cut to activate batch file not working

 

 

<redyellowgreenblue@gmail.com> wrote in message

news:cf78b5f3-94d3-47da-925b-4d7abbec2703@s50g2000hsb.googlegroups.com...

> Hi

>

> I've set-up a batch file to automatically hibernate my computer (the

> code is "RUNDLL32.EXE PowrProf.dll,SetSuspendState").

>

> I've then created a shortcut to this on the desktop, and assigned it

> the keyboard shortcut CTRL+ALT+H using the /Properties/Shortcut

> option.

>

> But it doesn't work. Actually, it worked once, but then never again.

> I've tried it with no other programs running, but no luck.

>

> Should customised keyboard short cuts work to activate batch files?

 

As Julius Cesar said: Divide and conquer! In other words, your first step

should be to divide the two functions, then find out which one does not

work. The functions are:

 

Function 1: Invoke the shortcut using Ctrl+Alt+H

Function 2: Run rundll32.exe

 

You can test Function 2 by manually double-clicking your shortcut directly.

 

You can test Function 1 by pointing it at a batch file. The batch file

should contain the following three lines:

@echo off

echo %date% %time% %Username% >> c:\test.txt

RUNDLL32.EXE PowrProf.dll,SetSuspendState 1>> c:\test.txt 2>>&1

 

Now click Ctrl+Alt+H, then examine c:\test.txt. Does it exist? Does it

contain a date stamp?

 

By the way, my computer, like many others, has an inbuilt keyboard shortcut

to force Windows into hibernation: Fn+F4. You might want to check your

manual to see if you don't have a smiliar inbuilt shortcut.

Guest Nepatsfan
Posted

Re: Customised keyboard short cut to activate batch file not working

 

<redyellowgreenblue@gmail.com> wrote in message

news:cf78b5f3-94d3-47da-925b-4d7abbec2703@s50g2000hsb.googlegroups.com...

> Hi

>

> I've set-up a batch file to automatically hibernate my computer (the

> code is "RUNDLL32.EXE PowrProf.dll,SetSuspendState").

>

> I've then created a shortcut to this on the desktop, and assigned it

> the keyboard shortcut CTRL+ALT+H using the /Properties/Shortcut

> option.

>

> But it doesn't work. Actually, it worked once, but then never again.

> I've tried it with no other programs running, but no luck.

>

> Should customised keyboard short cuts work to activate batch files?

 

 

Just out of curiosity, is there some reason you've made this complicated by

using a batch file?

 

Instead of having your desktop shortcut point to your batch file, enter the

following command in the Target box on the Shortcut page of the desktop

shortcut's Properties sheet.

 

%windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState

 

Click in the Shortcut key box.

Hit the H key.

Click OK.

 

See what happens when you hit Ctrl + Alt + H.

 

Good luck

 

Nepatsfan


×
×
  • Create New...