DOSKEY

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: DOSKEY

#16 Post by Acy Forsythe » 05 Jul 2011 22:08

I have always been under the impression that batch files and Doskey were synonymous. Two entirely different ways of saying the same thing.

I've always used it to record command history, but after XP (maybe even Win98) that's no longer necessary so I haven't used it in years.

What else can Doskey do that a batch file can't?
What benefit does bringing them together get you?

I've seen lots of very neat tricks with batch files, but the limitation of Doskey is that it requires input from Interupt 16 and batch output does not go to Interupt 16. With all of the tricks I've seen, I don't know that anyone could make that happen without support from external applications, and as someone mentioned earlier in this thread, if you're already using an external tool... why not just use the external tool?

trebor68
Posts: 146
Joined: 01 Jul 2011 08:47

Re: DOSKEY

#17 Post by trebor68 » 09 Jul 2011 07:49

The only one thing that can DOSKEY is simulated the inputs from keyboard.

With the following batch can you see that is not only can start command with DOSKEY.
Start this file from the command line.

step 1: Please start the batch and press only the key "Enter" when is comming the first input command ("Name 1:").

test 1: Please input at the prompt "P1".
test 2: Start "DOSKEY-Test" and input "T1" at input command ("Name 1:").
test 3: Start "DOSKEY-Test" and input "T2" at input command ("Name 1:"). For the last input command i.E. "Sandy".
test 4: Start "DOSKEY-Test" and for the first input command i.E. "Sandy". And input "T2" at input command ("Name 2:").

DOSKEY-Test.BAT

Code: Select all

@echo off
for %%a in (1 2 3 4) do set "inp%%a="
set /p inp1=Name 1:
if "%inp1%"=="" goto :test
set /p inp2=Name 2:
set /p inp3=Name 3:
set /p inp4=Name 4:
echo.
echo.
echo Game 1: %inp1% - %inp2%
echo Game 2: %inp3% - %inp4%
echo Game 3: %inp4% - %inp2%
echo Game 4: %inp3% - %inp1%
echo Game 5: %inp2% - %inp3%
echo Game 6: %inp4% - %inp1%
:: doskey doskey-test=
goto :eof
:test
doskey p1=doskey-test$tAngelina$tHeather$tKylie$tMelissa
doskey t1=Nicole$tJodie$tJessica$tAndrea
doskey t2=Laura$tLexa$tLisa
echo Please start it again.


The command DOSKEY can also input from the command line without change the code from the batch file.
I think that is a good way, when you make a batch file and test this with special input.

Post Reply