Artisan
Artisan

Reputation: 4112

Setup windows doskey for echo > filename.txt

My goal is to setup doskey to imitate unix touch command as touch filename.txt

Without doskey I use echo . > filename.txt in the windows's command prompt

I successfully setup doskey touch=echo $* but I must use it as touch > filename.txt, I have tried to play around using doskey touch=echo > $*, this causes echo to be not recognized by the windows's command prompt.

Please help, thanks.

Please help,

Upvotes: 1

Views: 525

Answers (1)

Marcel
Marcel

Reputation: 1191

Try this

doskey touch=copy nul $* > nul

This bit of code exploits the copy command to make a new file. $* is the string you put after touch.

Upvotes: 4

Related Questions