Use %CD%
instead of %~dp0
.
EDIT:
B2EC is not a real converter. Creation location of equipped .cmd file was chosen to be %TEMP%
and this is a good choice. Application just lacks 3rd option for working directory of the script - .exe file directory. I advise you to mail the author about adding this one.
Different paths for .exe and created .cmd lead to information loss, i.e. we are unable to know .exe directory and current directory at the same time without providing additional information to the script (e.g. using environment variable or passing it as first/last argument to the script). This script would need to handle it and we would end writing cmd scripts tailored for this converter, which is bad.
%~dp0
- script directory (%TEMP%/.../
) - practically useless
%cd%
- working directory (as set up in the converter) - currently there are only 2 options: current directory (working directory of .exe) and temporary directory (actually equal to %~dp0
, but without trailing backslash)
I think it can be solved by patching cmd.exe
instance in memory to change the script path, but that's B2EC developer's duty.
Side note: Normal executable files can be easily executed with specified 0th argument by providing appriopriate lpApplicationName
and lpCommandLine
to CreateProcess
function. Command files are executed via cmd.exe
, so 0th argument cannot be set this way.