Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 01-20-2007, 10:30 PM
Ron G
Newsgroup Contributor
 
Posts: n/a
XP problem passing command arguments with spaces

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 01-20-2007, 10:30 PM
  #2 (permalink)  
Old 01-20-2007, 10:45 PM
Pegasus \(MVP\)
Newsgroup Contributor
 
Posts: n/a
Re: XP problem passing command arguments with spaces


"Ron G" <sellingforcash@cox.net> wrote in message
news:HyDsh.52648$z16.16221@newsfe10.phx...
> 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.


Surround your file names with double quotes, e.g.
"c:\directory with spaces\test.txt". BTW, DOS is an
operating system, like Linux or Windows. There is no
DOS under Windows. I suspect you mean the "Command
Prompt" when you write "DOS window".


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 01-20-2007, 11:15 PM
Wesley Vogel
Newsgroup Contributor
 
Posts: n/a
Re: XP problem passing command arguments with spaces

What is WindowsXP file explorer? Windows Explorer (explorer.exe)?

What is a DOS window? Command.com? Use cmd.exe instead.

Use 8.3 names with no spaces or use quotes.

"c:\directory with spaces\test.txt"

You have to use quotes with some commands with cmd.exe, especially if the
path contains a white space.

<quote>
Remarks
Using multiple commands
* You can use multiple commands separated by the command separator && for
string, but you must enclose them in quotation marks (for example,
"command&&command&&command").

Processing quotation marks
If you specify /c or /k, cmd processes the remainder of string and quotation
marks are preserved only if all of the following conditions are met:

* You do not use /s.
* You use exactly one set of quotation marks.
* You do not use any special characters within the quotation marks (for
example: &<>( ) @ ^ |).
* You use one or more white-space characters within the quotation marks.
* The string within quotation marks is the name of an executable file.

If the previous conditions are not met, string is processed by examining the
first character to verify whether or not it is an opening quotation mark. If
the first character is an opening quotation mark, it is stripped along with
the closing quotation mark. Any text following the closing quotation marks
is preserved.

File and directory name completion correctly processes file names that
contain white space or special characters if you place quotation marks
around the matching path.

The following special characters require quotation marks: & < > [ ] { } ^ =
; ! ' + , ` ~ [white space]

If the information that you supply contains spaces, use quotation marks
around the text (for example, "Computer Name").
<quote>
from CMD...
Paste the following line into Start | Run and click OK...

hh ntcmds.chm::/cmd.htm

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:HyDsh.52648$z16.16221@newsfe10.phx,
Ron G <sellingforcash@cox.net> hunted and pecked:
> 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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 01-21-2007, 08:30 AM
Ron G
Newsgroup Contributor
 
Posts: n/a
Re: XP problem passing command arguments with spaces

I figured it out. Explorer.exe passes a string in quotes if the path
has white spaces in it. Those quotes must be removed before passing the
string to the fileopen statement.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing command line argument via Windows Shortcut Peter Lu Windows XP 4 09-19-2007 02:25 AM
Passing command line argument via Windows Shortcut Peter Lu Windows XP 0 09-19-2007 02:24 AM
Invalid Command Line arguments??? Jenna Windows Vista 11 09-09-2007 03:50 AM
Passing Validation Ray Windows Vista 2 06-26-2007 03:50 AM
Passing command line arguments Cornel Gligan Pocket PC General 2 01-15-2007 10:53 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 05:15 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0