-
Notifications
You must be signed in to change notification settings - Fork 25
Use double quotes to prevent word splitting may be better #25
Comments
One problem is that Win32 escaping/splitting of the command line is not 100% standardized. |
Update: when we go through cmd.exe we must also take into account its own parsing rules to do proper escaping. |
I didn't add quotes to the first argument(command), so Examples:
|
This is slightly more tricky than it looks like at first, for example for now with no quoting/escaping at all:
A reasonable expectation if we handle quoting and escaping would be that an attempt to run e.g. |
If someone run But if I want to edit |
Now:
A better way:
And so we shouldn't add |
A problem with never quoting/escaping the first param at all is also that e.g. |
|
But then you can't have your filenames you want to edit escaped, and the double escaping just for the (first) program is nasty. edit: more precise about what I did not know was possible :) |
So for now I more in favor of the general idea of quoting and escaping everything if needed, and nothing if doing for example: wcmd --raw 'notepad&pause', but I'll still think about it a bit before I implement anything. |
The first parameter of
So If I modify the code like this:
|
Yes, only with quotes though, and most of the time useless anyway; except when launching a command line program that does not changes the console title itself. So I plan to give it, at least by default, the same thing as the command. Also, its escaping rules are yet another time different (wtf...) |
When I pass a filename which contains spaces to wcmd/wrun/wstart:
or
aa bb.mp4
was splited to two filenames.So I wrote a shell function:
But I think wrun/wcmd/wstart should do this work, like this:
The text was updated successfully, but these errors were encountered: