I can't find any way to do, for example, the following:
cmd.exe /C "script.txt"
In other words, I need Command Prompt to (try) to execute file with any extension (not necessarily .bat
or .cmd
) if it contains valid batch script code. I'm looking for behavior similar to Unix shells:
./script.txt
While on Unix the shebang (#!/bin/sh
) is responsible for understanding that the file is actually a script, it seems like on Windows .bat
or .cmd
extensions play the same role, indicating a batch script file for Command Prompt.
Is it possible to avoid that and force Command Prompt to interpret a file with any name?
NOTE: Please, no answers like:
Give your file
.bat
or.cmd
extension.
That's not what the question is about.