If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin; otherwise, the file name is ambiguous. For example, consider the string "c:\program files\sub dir\program name". This string can be interpreted in a number of ways. The system tries to interpret the possibilities in the following order:
c:\program.exe files\sub dir\program name
c:\program files\sub.exe dir\program name
c:\program files\sub dir\program.exe name
c:\program files\sub dir\program name.exe
So if you want to behave like CreateProcess, you'll have to include file tests in your regexp or solution.
But like I said above, this is a wrong answer, but it might be the wrong answer you're looking for.
It's wrong cause it fails to handle "c:\program.exe files\sub" as "c:\program.exe files\sub.exe" if "c:\program.exe" exists.
It's wrong cause it fails to handle "c:\program.exe files\sub" as "c:\program.exe" if "c:\program.exe" doesn't exists or is currently unavailable (say due to network problems).
In reply to Re^3: Using regex to separate parameters
by ikegami
in thread Using regex to separate parameters
by resistance
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |