-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Incongruent behavior using cmd.exe to open URLs in some cases #4981
Copy link
Copy link
Closed
Labels
Description
- Your Windows build number:
Microsoft Windows [version 10.0.18362.657]
- What you're doing and what's happening:
Trying to open URLs via cmd.exe. There are some important differences on using it on win32 and WSL that I don't know how to overcome or if it's a bug or not. This problem has risen on a multiplatform javascript package to open URLs - https://github.com/sindresorhus/open and I have created an issue there because of this strange behavior of cmd.exe on WSL - sindresorhus/open#170:
// URL used on cmd.exe "https://sindresorhus.com/?abc=123^&def=456"
cmd.exe /s /c start "" "https://sindresorhus.com/?abc=123^&def=456"
// WIN32 and WSL have different behaviors
// WIN32: Opens https://sindresorhus.com/?abc=123^&def=456
// WSL: Opens https://sindresorhus.com/?abc=123&def=456
// URL used on cmd.exe "https://sindresorhus.com/?abc=123&def=456 a"
cmd.exe /s /c start "" "https://sindresorhus.com/?abc=123&def=456 a"
// WIN32 and WSL have the same behavior and open https://sindresorhus.com/?abc=123&def=456%20a
// URL used on cmd.exe "https://sindresorhus.com/?abc=123^&def=456 a"
cmd.exe /s /c start "" "https://sindresorhus.com/?abc=123&def=456 a"
// WIN32 and WSL have the same behavior and open https://sindresorhus.com/?abc=123&def=456%20a
The only incongruence is when there are no spaces in the URL - in WSL it's necessary, for some reason, to escape & characters, while on win32 this is can't be done or it will open a different URL.
- What's wrong / what should be happening instead:
I was expecting the same behavior on WSL and win32 when running:
cmd.exe /s /c start "" "https://sindresorhus.com/?abc=123^&def=456"
- Strace of the failing command, if applicable: https://gist.github.com/tiagonapoli/96ee63ea64dd2061a3d603ac880d574a
Reactions are currently unavailable