Reading the Command$ {Urgent}

I have a problem with the Command$ string when
launching my application. Problem is as follows,
I get the file in the MS DOS string format.
C:\My Worksh~1\Java\This Direct~1\Frame~1.JAV

I would like to know if their is a way of forceing
the full path to the Command$ so that the above example
can look like this...
C:\My Workshop\Java\My Directory\Frame.Java

Who is Participating?
caraf_gConnect With a Mentor Commented:

I haven't got time to write out the exact code but the gist of it is the following:

1 Use Dir$ to get the long name of each sub directory
2 Use Instr to find the slashes (/) in your Command$ string

This way you can get "Frame1.Java" if you put in the full Command$, then remove everything from the last slash onwards to get "My Directory" (use vbDirectory in the Dir$ statement), remove the next slash and everything onwards to get "Java" and so on in a loop until you've hit the <drive>: bit.

Hope this helps
It should pass in what you put on the line verbatim. How are you triggering your program? If it's from a batch file then the command interpriter is doing it and not the VB.

Try creating a batch that explicitly sticks in what you want.


According to Microsoft:

in the association dialog View.Options.FileTypes..

if you define the application and arg as:
C:\ThePath\TheExe.exe %1
then you will get the 8.3

if you define it as
"C:\ThePath\TheExe.exe" "%1"
then you will get long file names

I created a simple VB5 app that does nothing 'cept MsgBox(Command$) and interestingly enough, I got long file names in both situations.  Pls note that I am running NT srvPack4, not that it should make a difference.

Hope this helps

Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

if you are interested it was Article ID: Q150706 via support online.
Erm... for something so urgent you don't seem to be in much of a hurry evaluating the answer and the comments?


load 'em torpedoes cap'n we bein' pinged!
All Courses

From novice to tech pro — start learning today.