1

How can I programmed batch file at windows xp that it will perform combination of keys? for example: win+L to switch user or other combinations.

2
  • 1
    This does not belong on superuser - batch files are programming as well, unless you're a programming snob :-) Commented Feb 21, 2010 at 10:53
  • @paxdiablo I am the last person to banish something onto SU - in fact, I frequently fight with people to keep questions here :) I misunderstood the question, I thought he wants to customize his PC, which is obviously not the case. Commented Feb 21, 2010 at 11:02

2 Answers 2

5

I'm not sure how easy it is to do this with sending key sequences but just about any action can be done by calling the appropriate executable.

For example,

rundll32.exe user32.dll, LockWorkStation

will do what WinL normally does.

This site shows quite a number of possibilities.

Sign up to request clarification or add additional context in comments.

1 Comment

+1. Creating a mechanism that simulates keystrokes would be a huge effort - much easier to call the associated commands.
3

Have you considered that a batch file may not be the best approach? The Windows Scripting Host has a "SendKeys" function which can be called from VBScript.

IIRC, WSH can be called from other scripting languages too.

1 Comment

+1 And if the OP wants, he/she can have a batch file that triggers JScript or VBScript via cscript.exe: cscript.exe /nologo scriptname "keys to send", for instance, if the script accepts the keys to send as a string (accessible from WScript.Arguments).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.