When running cmd or bat file in administrator mode, a path error occurs.

I'm using Comfyui recently, and I don't know why. Sometimes Git cannot be accessed, and sometimes the folder cannot be accessed. I just want to run the bat command directly in administrator mode and give it the highest permissions. Try it. But for such a simple question, after searching for a long time, I found a lot of unreliable tutorials, and it took a lot of code to solve it. But in fact, just add a paragraph to the bat file. It will jump to the folder where the current bat text is located.

Just add the following code.

cd /d "%~dp0"

Insert image description here

Guess you like

Origin blog.csdn.net/KiTok/article/details/134340486