I have added a batch-file ("addpath.bat") as a system path so that I can run it from any folder using the command "addpath". I need the program to return the the path from where the program is called (not the location of the actual file "addpath.bat").
I have tried:
%cd%
But that gives me the location of the actual file, which is not what I want.
"addpath.bat"
cd C:\path\to\pythonfile
SET mypath=%cd%
python addpath.py %mypath%
The python-file is only used to print out the output of the batch-file
"addpath.py"
import sys
print(f'\n\nThis is the path: {sys.argv[1]}')
If I am opening the terminal (CMD or PowerShell) on the desktop ("C:\Users\user\Desktop") i expect to have the program return the path:
C:\Users\user\Desktop