- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to write a QuickWin program that I can drag and drop an input file onto the executable to open and run the file. I tried using GETARG to get the directory and file name so the program could read the input file. GETARG couldn't read the pathname correctly.
Example:
Real pathname -> C:PROGRAM FILESMICROSOFT VISUAL STUDIOCommonMDSEV98MYPROJECTSMISCSOURCE web.f
What GETARG reads -> C:PROGRA~1MICROS~2CommonMSDEV98MYPROJ~1MISCSO~1 web.f
Is there some other way to get the correct pathname? Am I doing something wrong?
Jim Breeding
Example:
Real pathname -> C:PROGRAM FILESMICROSOFT VISUAL STUDIOCommonMDSEV98MYPROJECTSMISCSOURCE web.f
What GETARG reads -> C:PROGRA~1MICROS~2CommonMSDEV98MYPROJ~1MISCSO~1 web.f
Is there some other way to get the correct pathname? Am I doing something wrong?
Jim Breeding
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is correct - that's how Windows mangles long file names when it thinks that applications may not understand them. GETARG is just returning what Windows supplied.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried actually opening the file with the 'mangled' path?
I think Windows should still recognise it.
If you look in the registry, you come across many similar mangled paths with ~1, ~2 in them, and Windows still 'knows' what they 'really' are, otherwise the registry entries are useless.
What version of Windows are you using?
I have used GETARG in this way on '98, NT and 2000
and had no problems except those caused by me.
I think Windows should still recognise it.
If you look in the registry, you come across many similar mangled paths with ~1, ~2 in them, and Windows still 'knows' what they 'really' are, otherwise the registry entries are useless.
What version of Windows are you using?
I have used GETARG in this way on '98, NT and 2000
and had no problems except those caused by me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Umm.. I think your problem may be because of the way you
have your disk formatted (to find out, open Explorer and right-click on the disk icon and select Properties). Mine was changed from FAT to NTFS some time back. I think FAT has the problems with long filenames. You may find the problem disappears when you convert to NTFS (See Windows Help for instructions etc.). You will also save space on your disk. HTH
have your disk formatted (to find out, open Explorer and right-click on the disk icon and select Properties). Mine was changed from FAT to NTFS some time back. I think FAT has the problems with long filenames. You may find the problem disappears when you convert to NTFS (See Windows Help for instructions etc.). You will also save space on your disk. HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can open the file with the mangled pathname. I just panicked when I saw the output from a test program that simply wrote out the pathname. When I added file read logic it work fine. Microsoft!!??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may find that if the path and filename have been mangled twice (i.e. ~1 and ~2 appear in the same file-path-name), then Windows may fail to resolve it correctly. I recall this happening to me in the past.
good luck.
good luck.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page