-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Shell expansion variables %~f0, %~p0, %~x0, %~s0, %~a0, %~t0, %~z0, %~dp0, %~nx0, %~fs0 and %~ftza0 are broken when script file is enclosed in quotes #15212
Comments
Wait, just to confirm - does this repro the same way in both If so, I'd be inclined to say that this is just the way |
Yes
I don't know if Windows Terminal developers would be the same as cmd.exe developers, but if this is not the right place, would you be able to escalate the issue to the relevant developers of cmd.exe inside Microsoft? It does not seem that this should be shrugged off as a case of "broken by design". |
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 If you'd like a modern shell, PowerShell is really quite good. Yori and Clink are some other team favorites that are more cmd-like. Sorry 😕 |
…n is broken, by attempting to look up emcc first in EMSCRIPTEN, and then in PATH if it cannot be expanded to via %~dp0. Add a new test other.test_windows_batch_file_dp0_expansion_bug to check for this scenario.
* Work around Windows bug microsoft/terminal#15212 where %~dp0 expansion is broken, by attempting to look up emcc first in EMSCRIPTEN, and then in PATH if it cannot be expanded to via %~dp0. Add a new test other.test_windows_batch_file_dp0_expansion_bug to check for this scenario. * Update bat scripts to avoid ':' inside if() blocks.
When calling |
Windows Terminal version
all
Windows build number
10.0.19041.508
Other Software
No response
Steps to reproduce
correct.bat
contained in the zip file and observe the generated print.broken.bat
and observe the generated print.The zip file contains the following bat scripts:
testscript.bat
correct.bat
broken.bat
Expected Behavior
Both
correct.bat
andbroken.bat
should print out exact same output.Running
correct.bat
prints the expected behavior:Actual Behavior
broken.bat
will print out incorrect expansion of the shell expression variables~f0
,%~p0
,%~x0
,%~s0
,%~a0
,%~t0
,%~z0
,%~dp0
,%~nx0
,%~fs0
and%~ftza0
. In that script, the invocation of the test script is enclosed in quotes, which is sometimes necessary e.g. when a path contains spaces in it.In other words, calling
testscript.bat
works, but calling"testscript.bat"
does not.Running
broken.bat
prints the incorrect behavior:Note the contents of
correct.bat
:and
broken.bat
is identical, but it just encloses the invocation oftestscript
in quotes:which should not have any functional difference, yet the behavior of the scripts differ.
The text was updated successfully, but these errors were encountered: