Reputation: 855
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.
Upvotes: 3
Views: 46422
Reputation: 21
you can use
xcopy Name.txt (your Folder)
ren Name.txt Name.bat
call Name.bat (or full location of Name.bat)
it should work
Upvotes: 2
Reputation: 10877
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.
Upvotes: 6