Solved Running a file as a .bat

Hewlett-packard / Pavilion hpe
August 25, 2014 at 06:28:47
Specs: Windows 7 Professional, 3.6GHz 16GB
Hello!

I have a question. I am working on a script, and I need to have it call another script that is not using the .bat extension though it IS a batch file "on the inside". In other words, how do I make CMD accept other extensions as batch files? How do I do this (if possible)?

Thanks in advance :)

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


See More: Running a file as a .bat

Report •


#1
August 25, 2014 at 07:10:57
A batch file has to have the extension .bat (or .cmd). Why the requirement for a non-standard name? Just rename the file.

(There is no such thing as a "batch file on the inside"; it's just a text file.)

message edited by ijack


Report •

#2
August 25, 2014 at 08:47:34
I'd like to have my own extension on the sub-scripts.

What I meant with "on the inside" was that, cmd won't recognize the file as a batch file if it doesn't have the .cmd or .bat extension.

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


Report •

#3
August 25, 2014 at 08:47:47
✔ Best Answer
The only way I can see to do this is to use the first script to rename the second one to bat, then to rename it back to "whatever it originally was" after it has run.

Always pop back and let us know the outcome - thanks


Report •

Related Solutions

#4
August 25, 2014 at 10:05:23
That seems like a lot of effort for little reward. Just call the main one .bat and the sub-scripts .cmd if you want to differentiate them.

message edited by ijack


Report •

#5
August 25, 2014 at 10:25:56
Yes, I guess it would help if we understood the requirement a little better.

Always pop back and let us know the outcome - thanks


Report •

#6
August 25, 2014 at 21:07:42
You can define your own file types. But to get cmd.exe batch processor to CALL a script with a non-standard name is another story.

You'd need to hack cmd.exe; I wouldn't even consider it.

=====================
M2 Golden-Triangle


Report •


Ask Question