I need to quote a path in a portable way, shlex.quote is converting slashes to / on windows, which causes the command to fail (using the default windows command prompt).
Returning C:/Users/Me/Documents/Projects/Test
Instead of C:\Users\Me\Documents\Projects\Test
How can I quote a path on windows, similar to shlex.quote that uses native slashes, suitable for the windows command prompt and BAT files?
As mentioned by some comments, your problem might not be caused by shlex.quote().
Nevertheless there is the module mslex which provides mslex.quote() and mslex.split() for the Windows shell, just like what shlex provides for the Unix shell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With