3 ms·
I also wonder if the existence of these APIs has something to do with DOS and Windows, where the command line is actually a single string and quoting is a night
by jmmv 5y ago
I also wonder if the existence of these APIs has something to do with DOS and Windows, where the command line is actually a single string and quoting is a nightmare.
I wrote a little bit about this related issue here: https://jmmv.dev/2020/11/cmdline-args-unix-vs-windows.html https://jmmv.dev/2020/11/cmdline-args-unix-vs-windows.html
- ChrisSD 5y agoGood post! It's an interesting role reversal. Usually Unix is all about passing raw strings around whereas Windows is much more comfortable with passing structured data (see also COM). I would warn that "CommandLineToArgvW" does not necessarily do what the C runtime does. They are different implementations. Also your main problem in that post seems to have been in using `cmd.exe` and DOS utilities. The command prompt is all about mimicking DOS and not breaking .bat files from 80s and 90s. It's essentially stuck in stasis. Powershell is the actively developed shell (now on version 7).
- jmmv 5y agoSure, but the kernel has no concept of arguments: all it sees is a plain string. PowerShell can do things better as long as you stay within its domain, but things break down when you talk to other binaries. Touched upon that here https://jmmv.dev/2020/10/powershell-cmdlet-params.html https://jmmv.dev/2020/10/powershell-cmdlet-params.html ;)