For instance, let's say I have a folder with the following in it:
log.bat
clear.bat
new.bat
init.exe
Each .bat
file calls init
once or more times. I do not have access to any of the .bat
files, so there is not way that I can pass a variable to init.exe
. One thing to know about init
is a C# application and can accept arguments.
Possibilities:
- DOSKEYS - Turns out that they don't work for
.bat
files. - Environment Variables - I thought I could name an environment variable called
init
that would do something likeinit %~n0
to get the batch file name. Sadly, this doesn't work either. - Hacky Alias - Make a batch file named
init.bat
(as the.bat
files callinit
, notinit.exe
). Then, in theinit.bat
file, I would simply putinit.exe %~n0
. Two things went wrong with this. First, the.bat
files for some reason tookinit.exe
priority overinit.bat
, and so the batch file alias wasn't even called. Secondly, the%~n0
part expanded toinit
, as it was called frominit.bat
, not the other batch files.
Am I out of luck? Or is there a hacky method that could work for this?