|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Command line argumentHi 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 Show quoteHide quote "snow" wrote: > 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! > > 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 Kerry Moorman wrote: Show quoteHide quote > snow, > > If you are using VB 2005 you might try using > My.Application.CommandLineArgs(0) instead of the Command function. > > Kerry Moorman > > "snow" wrote: > > > 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! > > > >
Are optional parameters really an advisable thing to use ?
Citrix, VB.NET and Repaint keypressed regex question Setting breakpoints in VB2005 Truly transparent label. Writing to Multiple Files - VB6 How to find the position of the first dash in a string Iterate a structure to get name and value Converting a string to a Form object |
|||||||||||||||||||||||