Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to DIRECTLY execute command in txt file in cmd?

I have a question.

How can I execute command in a plain text file?

I know it seems crazy and I can simply rename it as a .bat file BUT it is important for me.
Without renaming it, can i execute it in CMD?

I know I can simply do this :

ren command.txt command.bat & call command.bat & ren command.bat command.txt

But this is too inconvenient. Any simpler way?

like image 909
Jamie Avatar asked Feb 09 '14 09:02

Jamie


1 Answers

cmd < command.txt

Of course it depends of the real content of command.txt.

like image 132
MC ND Avatar answered Oct 08 '22 16:10

MC ND