Task
I'm trying to make a launcher (in batch) for my (almost) all batch program in the Program Files (x86) folder. I also need it to be compatible with any one's Windows 10 machine.
Problem
The cd command does not evaluate the path correctly. It just says The directory name is invalid.
Code
@echo off
color 02
cls
cd "%~dp0batchfile.bat"
start /max /realtime %cd%
exit
Debug
I've moved the file around, adjusted the code, and even put the raw path and it all worked! But it still gives the error and causes the program to malfunction. I'm worried it can cause damage to someone's computer and to others' as well. (It's pretty overcomplicated for batch lol) I've also tried to echo the cd before, the path it's supposed to be set to, and the cd after. The cd before and what it's to be set to is fine, but it still says The directory name is invalid.
And "doesn't" get set. Here is the code I tried:
@echo off
color 02
cls
cd "%~dp0batchfile.bat"
rem Debug:
echo %cd%
pause
rem real code:
start /max /realtime %cd%
exit
And it's fine. It gives the error, yet it works without interruption and causes less lag and glitches. I haven't a clue why because for my smol phatt brain this shouldn't even be possible. Bless you. Maybe it's just a bug that Microsoft needs to fix, but whatever it is, it is so annoying and it ruins the cleanliness of my (almost) all batch program.
Conclusion (That you made)
You think: This imbecile doesn't even know where to START when asking questions on StackOverflow.
Me reading your thoughts: This is the first question I ask on StackOverflow. So yes, I mean no, no yes, wait wait no, I don't know where to start. What? Bless you. Oop Bless you again.