Tripredacus Posted July 24, 2019 Share Posted July 24, 2019 A program that I wrote for Windows 7, that works in 8.1 and all versions of Windows 10 up to 1809, does not work in 1903. The one thing that is changed is running a .cmd file, and I am supposing what the "context" of where the file is run. This seems to be correct, but others can test if they want. In Windows 7 through Windows 10 1809, executing a CMD would run relative to the CMD or call origin to the cmd.exe. Example. On the desktop is a .exe and a folder. Inside of the folder there is a .cmd file. From the compiled .exe, execute a call such as: "cmd /c c:\users\Administrator\desktop\folder\batch.cmd" and inside of that .cmd is "cd folder." This would have to be done because the source .exe is sitting on the desktop, and you would have to CD into the folder to get to those files. A person writing batch would do this for situations where abolute paths do not work (because programs inside required relative paths, or other situations). In Windows 10 1903, the .cmd is run relative to the default CMD path? Example: same as above, but it will fail. Running manually from default CMD context (Win+R cmd.exe) which will default the path to C:\users\Administrator. Running the absolute path to the .cmd will result in the error of unable to find the folder you CD to. It is because now a direct call using CMD will be running in the context of C:\Users\Administrator, rather than C:\Users\Administrator\Desktop, where the initiator (EXE) resides or whatever the start path in the CMD is at the time of manual testing. If the location in CMD is C:\Users\Administrator, then the .cmd file needs to have CD Desktop\folder and it will work. Some small change but it delayed rollout of 1903 for some systems, because batch pathing behavior apparently changed. I hope I explained it properly. I can do a step-by-step breakdown tomorrow if someone doesn't figure out what I'm saying. Link to comment Share on other sites More sharing options...
cdob Posted July 25, 2019 Share Posted July 25, 2019 (edited) 6 hours ago, Tripredacus said: execute a call such as: "cmd /c c:\users\Administrator\desktop\folder\batch.cmd" and inside of that .cmd is "cd folder." At NT times, set the path to batch.cmd drive and path: batch.cmd cd /d %~dp0 or another relative path cd /d "%~dp0..\folder" cd /d "%~dp0folder" Does this works still? Edited July 25, 2019 by cdob 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now