Re: XP problem with command line arguments with spaces

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sat, 20 Jan 2007 22:18:32 -0800, Ron G <sellingforcash@xxxxxxx> wrote
something that piqued my interest enough to reply with:

In a VB6 application, any file path with spaces that is passed from
WindowsXP file explorer will not open in the application. I get a "File
does not exist". Yet I can open that same file using a common dialog
box in the application. I can also type the path as an argument from a
dos prompt.

MyApplication c:\directory with spaces\test.txt

This works from a DOS window but if I double click on the file I get the
"File does not exist". If I take the spaces out of the path it works
fine. In window 2000 and before I did not have a problem. Something
has changed in how XP passes arguments from the file manager.

Typically you would put quotes around a long name to force it to be
passed as one element;
MyApplication "c:\directory with spaces\test.txt"

2K/XP command prompts (CMD32) are long name aware so do not need the
quotes normally.

Start->Run does not appear to be long name aware for the calling
application but will pass any args without mangling them whether they
are in quotes or not;
"c:\directory with spaces\MyApplication" c:\directory with
spaces\test.txt
"c:\directory with spaces\MyApplication" "c:\directory with
spaces\test.txt"

Depending upon how you are accessing the command line args you may or
may not see the quotes on the passed args.

As Bob posted, how are you handling the command line args in your app ?
--
Alfie [UK]
<http://www.delphia.co.uk/>
Choosing between two evils is still choosing evil.

.



Relevant Pages

  • Re: But Microsoft cant help. At least Microsoft India cant.
    ... There may be a scroll bar at the right to see the lines scrolling off the top. ... If not, right-click the title bar at the top of the Command Prompt window, click Properties, Layout tab, and increase the height under Screen Buffer Size. ... quotes) and press Enter. ...
    (microsoft.public.windowsupdate)
  • Re: Help with athe syntax for Net Use command
    ... Try entering your command in this window and see what ... > Your original post did not have the double quotes. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: WIDOWS START Command Pathname with Blanks
    ... This exe is located in another directory so I have defined: ... WINDOW CANNOT FIND "1" ..... ... you need to put the paths that include spaces within double quotes. ... the windows start command (or perhaps just more recent ...
    (comp.lang.rexx)
  • Re: WIDOWS START Command Pathname with Blanks
    ... The START command seems tricky, but it's not really different from any of the other commands. ... If the first parameter is enclosed in quotes, then it is assumed to be the title of the started window. ...
    (comp.lang.rexx)
  • Re: How to pass arguments to external program
    ... I think this is what's going on: The PowerShell command line reads the ... entire string you're passing as one argument. ... white space, it wraps the string in its own set of quotes, which get passed ... uses them as separators when it breaks the command line up into the args ...
    (microsoft.public.windows.server.scripting)