Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%~dp0 is wrong in SHELL \"script\" (correct in SHELL script) #309

Open
3 tasks done
Kojoley opened this issue May 7, 2023 · 1 comment
Open
3 tasks done

%~dp0 is wrong in SHELL \"script\" (correct in SHELL script) #309

Kojoley opened this issue May 7, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Kojoley
Copy link
Contributor

Kojoley commented May 7, 2023

Make sure you completed the following tasks

Environment and version details

  • Operating System+version: Windows 10 22H2
  • Shell: cmd
  • B2 Version: HEAD,4.0.0

Brief problem description

Steps to reproduce the issue

C:\correct\asd.bat

echo %%~dp0=%~dp0

C:\wrong\jamroot

ECHO unquoted [ SHELL asd ] ;
ECHO quoted   [ SHELL \"asd\" ] ;

Execute following:

set PATH=C:\correct;%PATH%
cd C:\wrong
b2 -fjamroot
unquoted %~dp0=C:\correct\

quoted %~dp0=C:\wrong\

...found 1 target...

Actual behavior summary

%~dp0 points to current working directory.

Expected behavior summary

%~dp0 points to the bat self path.

That doesn't happen for python scripts though

C:\correct\qwe.py

print(__file__)

C:\wrong\jamroot

ECHO unquoted [ SHELL qwe ] ;
ECHO quoted   [ SHELL \"qwe\" ] ;

Execute following:

set PATH=C:\correct;%PATH%
set PATHEXT=.PY;%PATHEXT%
cd C:\wrong
b2 -fjamroot
unquoted C:\correct\qwe.py

quoted C:\correct\qwe.py

...found 1 target...
@Kojoley
Copy link
Contributor Author

Kojoley commented May 8, 2023

Turns out it is a cmd.exe bug microsoft/terminal#15212 and they won't fix it:

Oh I'm so sorry to be the person that lets you know, but yea, cmd.exe isn't actively maintained anymore (beyond security patches). Yea, the Terminal team does own cmd.exe, but we're not gonna be making any changes to it anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant