Command line argument

S

snow

Hi all,

I want to drag a file and drop to my application icon on the desktop to
open the file. I use command line statement to catch the file location,
like the following:

dim cmd as string = Microsoft.VisualBasic.Command()

cmd is the file full path, it works if there is no white space in the
middle of the path. but if cmd contains a white space like cmd = "c:\my
documents\test.txt", it will show the error message "can't find the
file". I tried to use double quotes, it doesn't work either. Could
someone give me some suggestions?

Thanks in advance!
 
G

Guest

snow,

If you are using VB 2005 you might try using
My.Application.CommandLineArgs(0) instead of the Command function.

Kerry Moorman
 
S

snow

I am using VB.NET 2003. The problem is when I am running the program in
debug mode, the variable cmd pass the file path, and function
File.exists(cmd) returns true; when running in release mode, function
File.exists(cmd) returns false, I wonder if it is the MS window issue.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top