Click here to Skip to main content
13,899,460 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Dear Sirs,

I have a program that takes command-line arguments. The ordinary method of ingestion is drag-n-drop. So, you drag a (DICOM|*.dcm) file (or more) onto my program, it reads them and processes them without showing a form. No problem. A coworker pointed out today that the program doesn't work with "twelve or so" files. I tried it and can get 23 items to work, but adding the 24th screws it up. The error message is a simple msgbox saying:

"Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item." With the full path to the application in the title-bar.

My guess is that he was using rather deeply-nested or long-named files. I'm thinking what's happenning is that the shell is somehow not getting the program path correct with lots of parameters?? the parameters somehow obstructing the filename?? I checked it out and when I get the twenty-three items to work, the command-line length (with full program path) is 2,075 characters. Raymond[^] has lots to say about it, but my length isn't close to what he talks about: I'm nowhere near 32767, over 2048, and not near 8192, and well over the dos limit of 127.

I could do something creative if my program would just run, but it never gets to sub Main().

If anyone has had this problem before, please give me sympathy. Even better, if someone knows how to work around or fix this problem, please let me know!! I've searched the web for a while and nothing came up. I was sure to check this forum to avoid double-posting. Thanks!

In Christ,
Aaron Laws

http://ProCure.com
Posted
Updated 5-Apr-10 21:15pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Using Windows Explorer/Tools menu/Map Drive Network, you might be able to shorten each of the file paths by mapping a drive letter to the folder your files are in, opening that drive letter using Windows Explorer, then selecting and double-clicking the files you want.

:)
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Just something else to look at. I've had similar issues where the space character being embedded in one of the folder names caused problems. Generally the highlighted files end up being tokenized by a space character and so an embedded one causes one filename to be split across two arguments.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

If you have the source code to the app you're trying to run, why don't you save your commandline arguments to a data file and either pass that argument file as the parameter, or make your app look for it automatically.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190306.1 | Last Updated 6 Apr 2010
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100