I had a job.cmd file I executed, but the containing commands was not executed as Windows could not locate the filename.exe files 😐 The problem was rather simple, the current directory (%cd%) while executing the job.cmd file was “c:windowssystem32”.. doh 🙁
Anyhow, found out that there is actually a simple way around this;
cd /d %IDP%
cd /d %OLDDIR%
This is rather simple, IDP (%IDP%) is set to the executing batch file’s directory via the IDP=%~dp0 and finally OLDDIR contain the ‘before’ current directory. If you need to set the %cd% at the end, well no probably not (but hey I’m a nice guy 😉 )..