Solved Using FOR to execute commands from non-bat file

January 28, 2015 at 13:33:16
Specs: Windows 7, 3.6GHz 16GB
Allright. I have a file. It's not a .bat. Inside it, there is a small set of commands, along with some other stuff which is commented out with ";".

I tried to use this to execute the commands inside the file:

for /f "EOL=; tokens=*" %%A in (file.dat) do %%A

However this did not work.

Is this possible to accomplish? And if so, how?

If infinity is infinite, is the square root of infinity infinite as well?
- Kurp Von Steiner


See More: Using FOR to execute commands from non-bat file

Report •


#1
January 28, 2015 at 14:57:29
A batch file has to have the extension .bat or .cmd. Otherwise the command interpreter won't recognize it as such, and so won't run commands in it as batch file commands.

(And in answer to the question in your signature - yes, the square root of infinity is infinite.)


Report •

#2
January 28, 2015 at 16:34:46
✔ Best Answer
Your script worked ok for me. Just tested on simple commands. If your test didn't work, it may be something in the nature of the commands you're trying to run.

Report •

Related Solutions


Ask Question