0

So I have two things I need to do, and it seems DOSKEY is the way to go but i am new to it. What I am trying to do is from the C prompt is change drives to D, then go into a folder called run_folder then execute a command that its redirect into a log file. So it would look like this.

C:\Users> D:
D:\> cd run_folder
D:\run_folder> run_command.exe > d:\run_folder\logs_current_date_time.txt 

I am trying to convert so that all i have to type is run_CA from the C prompt.. Any ideas? how i can accomplish this using DOSKEY

user990951
  • 1,469
  • 5
  • 26
  • 36

2 Answers2

5

Ok, so I'm 3 years late to this party but for others who might want to know you can use $T to split commands:

doskey run_CA=D: $T cd run_folder $T run_command.exe ^> d:\run_folder\logs_current_date_time.txt

Note the caret is required on the command line to escape the redirection, otherwise you'll redirect the output from doskey!

Dave Bower
  • 3,487
  • 26
  • 28
1

Put the three lines of code into a file named run_CA.cmd. Then you can type run_CA to execute it. No need for DOSKEY.

FrankPl
  • 13,205
  • 2
  • 14
  • 40
  • `run_CA.bat`, surely? The question is about DOS, not cmd.exe. – Jack Kelly Aug 11 '13 at 23:58
  • Actually, for most batch files there is no difference if they are called *.bat or *.cmd in Windows if you do not have one of the really old 16 bit Windows versions like Windows 95 or Windows ME. – FrankPl Aug 12 '13 at 08:00
  • 1
    Except it's talking about DOSKEY and is tagged "dos", not "cmd" or "cmd.exe". – Jack Kelly Aug 13 '13 at 06:08