Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute cmd command from text file?

As title says, I need to execute cmd command from text file.Let's say I have text file called file and in it it's written Color A.I need something like command: type file.txt and not just write it on screen, but I want it to press enter meanwhile.Batch file options are welcomed too.Thank you.

like image 538
Matt Martin Avatar asked Dec 29 '25 07:12

Matt Martin


1 Answers

You can use save your normal file with batch programming in it with .bat extension. And run that file WhateverNameItIs.bat on your command prompt.

Saved it as file.bat

 @ECHO ON
 ECHO Color A

In your case you can drag file from your where your are to command prompt. Or Using CD you can reach out where your file is saved within your command prompt. Fire up file.bat on your command prompt will execute whatever batch programming is written on that file.

like image 56
Vikalp Patel Avatar answered Dec 30 '25 23:12

Vikalp Patel