Command line argument

  • Thread starter Thread starter snow
  • Start date Start date
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!
 
snow,

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

Kerry Moorman
 
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
 
Back
Top