I am still confused about whether you want to detect a CTRL keypress or set the shift-flag for the CTRL key. Reading the keypress in a batch file is relatively simple. MS-DOS doesn't provide a method (internal or external) to read the key-state... but you could call a little program from the batch file designed to monitor the shift-states until a certain condition is met.
This was written in Quick Basic. It simply loops until a CTRL key is pressed.[tt]
DEFINT A-Z
TYPE RegTypeX
AX AS INTEGER
bX AS INTEGER
CX AS INTEGER
dX AS INTEGER
bp AS INTEGER
Si AS INTEGER
di AS INTEGER
FLAGS AS INTEGER
Ds AS INTEGER
ES AS INTEGER
END TYPE
DIM inregs AS RegTypeX, OutRegs AS RegTypeX
inregs.AX = &H1200
DO
CALL INTERRUPTX(&H16, inregs, OutRegs)
IF (OutRegs.AX AND 2 ^ 2) THEN
PRINT "CTRL key pressed"
SYSTEM
END IF
LOOP
[/tt]
There is an obvious problem using this approach under Windows: the keyboard state monitored in the batch file is meaningless in any other thread.
You might be able to set the shift state of the CTRL key by creating an OS hook with Interrupt 15h, function 4Fh but you will have the same problem. The results will only apply to the current copy of the command interpreter.
Can you get or set the the CTRL key in a batch file? Yes. Will that ability provide a useful tool? I doubt it.
Alt255@Vorpalcom.Intranets.com