-
Notifications
You must be signed in to change notification settings - Fork 55
Passing a command with spaces on Windows doesn't work #1
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
Comments
Thanks. TBH I wont find much time currently to look deeper into this issue - which is moreover a bit hard for me, since I don't use any Windows. If you happen to find a solution, I'd be happy to include it. The code for the class itself is not very complicated. Most if it is used to manage console arguments. The main magic with escaping happens in Thanks for helping in improving this class for Windows users! |
One more thing: You seem to have messed up the order when you try to escape a character. First, inside |
I've done some digging around and it turns out that windows command shell has a preset shortcut for "/Program Files" witch is "/Progra~1/". this is only works for the directory in question and is not applicable to the rest of the file system as far as I know |
This does mean that anybody accessing files with spaces in windows might have trouble but I'll look into that some more and try to find a way to use thees quotes. |
I'm pretty sure that there's a way to make it work with spaces. Let's keep this issue open for reference. |
Here's a comment from the
|
@DomiQ In case you're still there: If I add the above fix, would you be available for testing? Because I don't use Windows. |
I can test it sure, but I've got a bunch of projects to finish for college. On Fri, 20 May 2016 at 13:05 Michael Härtl [email protected] wrote:
|
That's great. I've pushed the fix to master. Maybe you find the time for a quick test. I could also create a release, if that's easier for you. |
Ok, great, master is fine. I'll test it when I find some free time. On Mon, 23 May 2016 at 18:29 Michael Härtl [email protected] wrote:
|
@DomiQ Ping ;). Did you maybe find a minute to give this a quick try? Should really not be hard to test. I just don't have Windows here so can't test it myselft. |
@mikehaertl I'm just now rerunning home from a trip so I can give it a run tonight or tomorrow morning and report back. :) |
I've tested the commit on a project I worked on back when the issue started and I can confirm that it works. I've also just tried pushing some bigger commands trough it and they all worked. Sorry it took me a while to test. |
Great news! Thanks! So I'll close this and prepare release 1.2.1. |
Sorry for moving the thread around, I got really confused with all the code.
When I try passing this as an exaple:
The program returns this:
It separates the DIR into different commands because of the spaces, to fix it you need to pass the DIR within the "" and that's where the problem kicks in.
When I try:
I just keep getting the same error as the one above.
When I try adding "/ instead of " to try and force php into making a quote within a string.
This is the confusing part, when I put:
It actually runs the command and partially works. So now I got the .exe running but it gives me an error as it cannot read the parameters it needs because of the "/ so I get:
Because the command is as follows getCommand:
The text was updated successfully, but these errors were encountered: