PC Review


Reply
Thread Tools Rate Thread

Cannot get shortcut keys working on batch files

 
 
Terry Pinnell
Guest
Posts: n/a
 
      8th May 2010
On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
shortcuts made from any batch file.

For example, Test-01.bat contains this

@echo off
pause

I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here

http://dl.dropbox.com/u/4019461/BatchProblem.jpg

But it doesn't run when I use the keys.

It runs fine if I d-click either the original batch file or its shortcut.

No difference after a reboot.

I installed a little program called Shortcut Key Explorer v1 01 by RJL
Software from http://www.rjlsoftware.com/software/.../shortcutkeys/
which lists all the keyboard shortcuts in use. It found the couple I've
successfully installed, such as a test with Calculator. But for the test
batch file, even though it's shown as having ctl-alt-3 assigned in
the Properties, the Shortcutkeys list doesn't include it.

Very frustrating!

Anyone have any ideas please?

--
Terry, East Grinstead, UK
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      8th May 2010


"Terry Pinnell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
> shortcuts made from any batch file.
>
> For example, Test-01.bat contains this
>
> @echo off
> pause
>
> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>
> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>
> But it doesn't run when I use the keys.
>
> It runs fine if I d-click either the original batch file or its shortcut.
>
> No difference after a reboot.
>
> I installed a little program called Shortcut Key Explorer v1 01 by RJL
> Software from http://www.rjlsoftware.com/software/.../shortcutkeys/
> which lists all the keyboard shortcuts in use. It found the couple I've
> successfully installed, such as a test with Calculator. But for the test
> batch file, even though it's shown as having ctl-alt-3 assigned in
> the Properties, the Shortcutkeys list doesn't include it.
>
> Very frustrating!
>
> Anyone have any ideas please?
>
> --
> Terry, East Grinstead, UK


Perhaps you need to invoke your batch file like so in the shortcut:
cmd /c "c:\Tools\MyBatchfile.bat

About the list of current shortcuts: Try the following.
1. Copy and paste the code below into c:\Windows\ShortcutKeys.vbs
2. Double-click it. It will scan each and every shortcut you have and report
if there is a shortcut key combination.
3. Report the result.

aKeys = Split("Ctrl+Shift,"",Alt+Shift,Alt+Ctrl", ",")
Set oWshShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sList = "\Links.txt"
sProfiles = oWshShell.ExpandEnvironmentStrings("%UserProfile%\..")
sTemp = oWshShell.ExpandEnvironmentStrings("%Temp%")
oWshShell.Run "cmd.exe /u /c dir /s /a /b """ & sProfiles & "\*.lnk"" > """
_
& sTemp & sList & "", 0, True 'Use Unicode for non-ASCII file names

Set oList = oFSO.OpenTextFile(sTemp & sList, 1, False, -1) 'Read the names
in Unicode format
aLinks = Split(oList.ReadAll, VbCrLf)
oList.Close
oFSO.DeleteFile (sTemp & sList)

iCount = 0
For Each sName In (aLinks)
If sName <> "" Then
iCount = iCount + 1
sString = oFSO.OpenTextFile(sName).Read(70)
cKey = Mid(sString, 66, 1) 'The bytes are read in reverse order . . .
Letter = Mid(sString, 65, 1)
If cKey <> Chr(0) Then MsgBox aKeys(Asc(cKey)-3) & "+" & Letter & " " &
sName, vbOK, "Link file keyboard shortcuts"
End If
Next


 
Reply With Quote
 
dadiOH
Guest
Posts: n/a
 
      8th May 2010
Terry Pinnell wrote:
> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
> shortcuts made from any batch file.
>
> For example, Test-01.bat contains this
>
> @echo off
> pause
>
> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>
> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>
> But it doesn't run when I use the keys.
>
> It runs fine if I d-click either the original batch file or its
> shortcut.
>
> No difference after a reboot.
>
> I installed a little program called Shortcut Key Explorer v1 01 by RJL
> Software from
> http://www.rjlsoftware.com/software/.../shortcutkeys/ which lists
> all the keyboard shortcuts in use. It found the couple I've
> successfully installed, such as a test with Calculator. But for the
> test batch file, even though it's shown as having ctl-alt-3 assigned
> in
> the Properties, the Shortcutkeys list doesn't include it.
>
> Very frustrating!
>
> Anyone have any ideas please?


Don't know about your specific problem but normally shortcuts being invoked
via a keyboard combo have to be in either the desktop or Start/Programs. Try
moving the shortcut to one of those.

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico



 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      8th May 2010
"Pegasus [MVP]" <(E-Mail Removed)> wrote:

>
>
>"Terry Pinnell" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
>> shortcuts made from any batch file.
>>
>> For example, Test-01.bat contains this
>>
>> @echo off
>> pause
>>
>> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>>
>> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>>
>> But it doesn't run when I use the keys.
>>
>> It runs fine if I d-click either the original batch file or its shortcut.
>>
>> No difference after a reboot.
>>
>> I installed a little program called Shortcut Key Explorer v1 01 by RJL
>> Software from http://www.rjlsoftware.com/software/.../shortcutkeys/
>> which lists all the keyboard shortcuts in use. It found the couple I've
>> successfully installed, such as a test with Calculator. But for the test
>> batch file, even though it's shown as having ctl-alt-3 assigned in
>> the Properties, the Shortcutkeys list doesn't include it.
>>
>> Very frustrating!
>>
>> Anyone have any ideas please?
>>
>> --
>> Terry, East Grinstead, UK

>
>Perhaps you need to invoke your batch file like so in the shortcut:
>cmd /c "c:\Tools\MyBatchfile.bat


Thanks Pegasus, but that still didn't fix it. See also my reply to dadiOH.

>About the list of current shortcuts: Try the following.
>1. Copy and paste the code below into c:\Windows\ShortcutKeys.vbs
>2. Double-click it. It will scan each and every shortcut you have and report
>if there is a shortcut key combination.
>3. Report the result.
>
>aKeys = Split("Ctrl+Shift,"",Alt+Shift,Alt+Ctrl", ",")
>Set oWshShell = CreateObject("WScript.Shell")
>Set oFSO = CreateObject("Scripting.FileSystemObject")
>sList = "\Links.txt"
>sProfiles = oWshShell.ExpandEnvironmentStrings("%UserProfile%\..")
>sTemp = oWshShell.ExpandEnvironmentStrings("%Temp%")
>oWshShell.Run "cmd.exe /u /c dir /s /a /b """ & sProfiles & "\*.lnk"" > """
>_
> & sTemp & sList & "", 0, True 'Use Unicode for non-ASCII file names
>
>Set oList = oFSO.OpenTextFile(sTemp & sList, 1, False, -1) 'Read the names
>in Unicode format
>aLinks = Split(oList.ReadAll, VbCrLf)
>oList.Close
>oFSO.DeleteFile (sTemp & sList)
>
>iCount = 0
>For Each sName In (aLinks)
> If sName <> "" Then
> iCount = iCount + 1
> sString = oFSO.OpenTextFile(sName).Read(70)
> cKey = Mid(sString, 66, 1) 'The bytes are read in reverse order . . .
> Letter = Mid(sString, 65, 1)
> If cKey <> Chr(0) Then MsgBox aKeys(Asc(cKey)-3) & "+" & Letter & " " &
>sName, vbOK, "Link file keyboard shortcuts"
> End If
>Next
>


Running it gave me an error message titled Windows Script Host:

Script: C:\WINDOWS\ShortcutKeys.vbs
Line: 9
Char: 3
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error

Running the utility I mentioned (of the same name) seems to do the job of
identifying valid (i.e. working) keyboard shortcuts however.

--
Terry, East Grinstead, UK
 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      8th May 2010
"dadiOH" <(E-Mail Removed)> wrote:

>Terry Pinnell wrote:
>> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
>> shortcuts made from any batch file.
>>
>> For example, Test-01.bat contains this
>>
>> @echo off
>> pause
>>
>> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>>
>> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>>
>> But it doesn't run when I use the keys.
>>
>> It runs fine if I d-click either the original batch file or its
>> shortcut.
>>
>> No difference after a reboot.
>>
>> I installed a little program called Shortcut Key Explorer v1 01 by RJL
>> Software from
>> http://www.rjlsoftware.com/software/.../shortcutkeys/ which lists
>> all the keyboard shortcuts in use. It found the couple I've
>> successfully installed, such as a test with Calculator. But for the
>> test batch file, even though it's shown as having ctl-alt-3 assigned
>> in
>> the Properties, the Shortcutkeys list doesn't include it.
>>
>> Very frustrating!
>>
>> Anyone have any ideas please?

>
>Don't know about your specific problem but normally shortcuts being invoked
>via a keyboard combo have to be in either the desktop or Start/Programs. Try
>moving the shortcut to one of those.


Thanks dadiOH, that's a breakthrough.

I was using a simple batch file for testing:

Test-01.bat
-----------
@echo off
pause

But it would not run from a keyboard shortcut. After moving the shortcuts
from C:\Batch to C:\Documents and Settings\All Users\Start
Menu\Programs\Batch as you suggested, it now does - EVENTUALLY.

It is taking some 20 seconds to run any shortcut with a keyboard shortcut!
This applies to ALL the shortcuts I've tried, not just those to batch files.
For example, shortcuts to Notepad, Calculator, etc. Yet all run immediately
if I d-click the shortcut instead of using the keyboard.

Any idea what on earth can be happening to take 20 seconds or so?!

I'll reboot after posting this to see if that makes any difference.

--
Terry, East Grinstead, UK
 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      8th May 2010
Terry Pinnell <(E-Mail Removed)> wrote:


>Thanks dadiOH, that's a breakthrough.
>
>I was using a simple batch file for testing:
>
>Test-01.bat
>-----------
>@echo off
>pause
>
>But it would not run from a keyboard shortcut. After moving the shortcuts
>from C:\Batch to C:\Documents and Settings\All Users\Start
>Menu\Programs\Batch as you suggested, it now does - EVENTUALLY.
>
>It is taking some 20 seconds to run any shortcut with a keyboard shortcut!
>This applies to ALL the shortcuts I've tried, not just those to batch files.
>For example, shortcuts to Notepad, Calculator, etc. Yet all run immediately
>if I d-click the shortcut instead of using the keyboard.
>
>Any idea what on earth can be happening to take 20 seconds or so?!
>
>I'll reboot after posting this to see if that makes any difference.


Rebooting didn't solve it.

Another odd thing is that if I try again some 10 minutes later, say with the
Notepad shortcut activated by ctl-alt-5, the first attempt brings up the
program immediately. All subsequent attempts take 20 secs or so, until after
another long wait when I get just the single correct result again.

Weird ...

--
Terry, East Grinstead, UK
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      8th May 2010


"Terry Pinnell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Pegasus [MVP]" <(E-Mail Removed)> wrote:
>
>>
>>
>>"Terry Pinnell" <(E-Mail Removed)> wrote in message
>>news:(E-Mail Removed)...
>>> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on the
>>> shortcuts made from any batch file.
>>>
>>> For example, Test-01.bat contains this
>>>
>>> @echo off
>>> pause
>>>
>>> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>>>
>>> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>>>
>>> But it doesn't run when I use the keys.
>>>
>>> It runs fine if I d-click either the original batch file or its
>>> shortcut.
>>>
>>> No difference after a reboot.
>>>
>>> I installed a little program called Shortcut Key Explorer v1 01 by RJL
>>> Software from http://www.rjlsoftware.com/software/.../shortcutkeys/
>>> which lists all the keyboard shortcuts in use. It found the couple I've
>>> successfully installed, such as a test with Calculator. But for the test
>>> batch file, even though it's shown as having ctl-alt-3 assigned in
>>> the Properties, the Shortcutkeys list doesn't include it.
>>>
>>> Very frustrating!
>>>
>>> Anyone have any ideas please?
>>>
>>> --
>>> Terry, East Grinstead, UK

>>
>>Perhaps you need to invoke your batch file like so in the shortcut:
>>cmd /c "c:\Tools\MyBatchfile.bat

>
> Thanks Pegasus, but that still didn't fix it. See also my reply to dadiOH.
>
>>About the list of current shortcuts: Try the following.
>>1. Copy and paste the code below into c:\Windows\ShortcutKeys.vbs
>>2. Double-click it. It will scan each and every shortcut you have and
>>report
>>if there is a shortcut key combination.
>>3. Report the result.
>>
>>aKeys = Split("Ctrl+Shift,"",Alt+Shift,Alt+Ctrl", ",")
>>Set oWshShell = CreateObject("WScript.Shell")
>>Set oFSO = CreateObject("Scripting.FileSystemObject")
>>sList = "\Links.txt"
>>sProfiles = oWshShell.ExpandEnvironmentStrings("%UserProfile%\..")
>>sTemp = oWshShell.ExpandEnvironmentStrings("%Temp%")
>>oWshShell.Run "cmd.exe /u /c dir /s /a /b """ & sProfiles & "\*.lnk"" >
>>"""
>>_
>> & sTemp & sList & "", 0, True 'Use Unicode for non-ASCII file names
>>
>>Set oList = oFSO.OpenTextFile(sTemp & sList, 1, False, -1) 'Read the names
>>in Unicode format
>>aLinks = Split(oList.ReadAll, VbCrLf)
>>oList.Close
>>oFSO.DeleteFile (sTemp & sList)
>>
>>iCount = 0
>>For Each sName In (aLinks)
>> If sName <> "" Then
>> iCount = iCount + 1
>> sString = oFSO.OpenTextFile(sName).Read(70)
>> cKey = Mid(sString, 66, 1) 'The bytes are read in reverse order . . .
>> Letter = Mid(sString, 65, 1)
>> If cKey <> Chr(0) Then MsgBox aKeys(Asc(cKey)-3) & "+" & Letter & " "
>> &
>>sName, vbOK, "Link file keyboard shortcuts"
>> End If
>>Next
>>

>
> Running it gave me an error message titled Windows Script Host:
>
> Script: C:\WINDOWS\ShortcutKeys.vbs
> Line: 9
> Char: 3
> Error: Expected statement
> Code: 800A0400
> Source: Microsoft VBScript compilation error
>
> Running the utility I mentioned (of the same name) seems to do the job of
> identifying valid (i.e. working) keyboard shortcuts however.
>
> --
> Terry, East Grinstead, UK


Glad you got it (partly) resolved. It is now a moot point but the error you
mention happened because your news reader split a long line into two
separate lines. Can't do this! The following code must be placed on one
single line:

If cKey <> Chr(0) Then MsgBox aKeys(Asc(cKey)-3) & "+" & Letter & " " &
sName, vbOK, "Link file keyboard shortcuts"


 
Reply With Quote
 
dadiOH
Guest
Posts: n/a
 
      8th May 2010
Terry Pinnell wrote:
> "dadiOH" <(E-Mail Removed)> wrote:
>
>> Terry Pinnell wrote:
>>> On this XP Pro (SP2) PC I cannot get any shortcut keys to work on
>>> the shortcuts made from any batch file.
>>>
>>> For example, Test-01.bat contains this
>>>
>>> @echo off
>>> pause
>>>
>>> I assigned it the shortcut <Ctl+Alt+3> (or any keys) as shown here
>>>
>>> http://dl.dropbox.com/u/4019461/BatchProblem.jpg
>>>
>>> But it doesn't run when I use the keys.
>>>
>>> It runs fine if I d-click either the original batch file or its
>>> shortcut.
>>>
>>> No difference after a reboot.
>>>
>>> I installed a little program called Shortcut Key Explorer v1 01 by
>>> RJL Software from
>>> http://www.rjlsoftware.com/software/.../shortcutkeys/ which
>>> lists all the keyboard shortcuts in use. It found the couple I've
>>> successfully installed, such as a test with Calculator. But for the
>>> test batch file, even though it's shown as having ctl-alt-3 assigned
>>> in
>>> the Properties, the Shortcutkeys list doesn't include it.
>>>
>>> Very frustrating!
>>>
>>> Anyone have any ideas please?

>>
>> Don't know about your specific problem but normally shortcuts being
>> invoked via a keyboard combo have to be in either the desktop or
>> Start/Programs. Try moving the shortcut to one of those.

>
> Thanks dadiOH, that's a breakthrough.
>
> I was using a simple batch file for testing:
>
> Test-01.bat
> -----------
> @echo off
> pause
>
> But it would not run from a keyboard shortcut. After moving the
> shortcuts from C:\Batch to C:\Documents and Settings\All Users\Start
> Menu\Programs\Batch as you suggested, it now does - EVENTUALLY.
>
> It is taking some 20 seconds to run any shortcut with a keyboard
> shortcut! This applies to ALL the shortcuts I've tried, not just
> those to batch files. For example, shortcuts to Notepad, Calculator,
> etc. Yet all run immediately if I d-click the shortcut instead of
> using the keyboard.
>
> Any idea what on earth can be happening to take 20 seconds or so?!


Nope but if you like KB shortcuts go get this. I've used it for years, easy
to use, never any problems.
http://www.brianapps.net/hotkeyplus/

Or here, the home page isn't working, don't know if that is temporary or
not.
http://www.softpedia.com/get/System/...Key-Plus.shtml

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico



 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      10th May 2010
"dadiOH" <(E-Mail Removed)> wrote:

>Terry Pinnell wrote:
>> "dadiOH" <(E-Mail Removed)> wrote:


>> Any idea what on earth can be happening to take 20 seconds or so?!

>
>Nope but if you like KB shortcuts go get this. I've used it for years, easy
>to use, never any problems.
>http://www.brianapps.net/hotkeyplus/
>
>Or here, the home page isn't working, don't know if that is temporary or
>not.
>http://www.softpedia.com/get/System/...Key-Plus.shtml


Thanks. However, I already have a couple of programs (Macro Express Pro and
my trusty old Stiletto power utility) which let me do that. I currently have
several hundred KB shortcuts assigned.

This particular requirement for a KB shortcut to a shortcut to a batch file
was because I occasionally get a 'runaway situation' when writing/testing
Macro Express macros. None of its documented STOP methods work in that
extreme situation. So chaos can sometimes rule for a while. I even have
trouble getting to XP Pro TM with Ctl-Alt-Del. So, after help in the
alt.msdos.batch.nt newsgroup I wrote a one-line batch file, ME-Kill.bat:

TASKKILL /F /IM MacExp.exe /IM MacEdit.exe /IM MacScript.exe

which stops the three processes making up Macro Express.

I wasn't particularly hopeful that it would work (because KB operation is so
disrupted), but thought I'd try it next time if Ctl-Alt-Del didn't work,
before hitting the Reset or Power-Off buttons. But obviously, this issue with
a possible 20 second delay is a show-stopper on that idea!

Meanwhile I assigned it to Ctl+Alt+k as a Stiletto KB shortcut to
ME-Kill.bat.

But I had a runaway last night giving me an opportunity to try it. It failed!

Eventually, I got TM up. So I'm guessing that, if *anything* will work in
those runaway states, Ctl+Alt+Del will - although it might take 30 secs or
more.

--
Terry, East Grinstead, UK
 
Reply With Quote
 
Billns
Guest
Posts: n/a
 
      10th May 2010
On 5/10/2010 12:03 AM, Terry Pinnell wrote:
> I currently have
> several hundred KB shortcuts assigned.


I think that may be the root of your problem delays. How can you
remember all those shortcuts?

Bill
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shortcut keys is not working =?Utf-8?B?YmVsbGViZWxsZTU=?= Microsoft Excel Misc 1 19th Sep 2004 08:26 PM
shortcut keys not working eli Windows XP Customization 4 25th Apr 2004 05:02 AM
Shortcut keys not working Feng Windows XP General 2 25th Mar 2004 09:01 AM
Re: shortcut keys not working Maureen Goldman Windows XP General 0 3rd Sep 2003 01:07 AM
shortcut keys not working Jake Windows XP General 1 2nd Sep 2003 07:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:46 AM.