Command line not working when large
-
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: 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! Aaron
In Christ, Aaron Laws http://ProCure.com
-
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: 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! Aaron
In Christ, Aaron Laws http://ProCure.com
Raymond wrote:
If you are using the ShellExecute/Ex function, then you become subject to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.
Think about it, dragging files from Explorer and dropping them onto your application requires something to start the application. I would venture to suggest that Explorer uses
ShellExecute/Ex
to do just that, hence the 2048 character limit.It's time for a new signature.
-
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: 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! Aaron
In Christ, Aaron Laws http://ProCure.com
you should not take 20 or more RX'es for a single patient, medical costs are skyrocketing as it is, nor mix pictures from different patients in a single run of some app, to avoid mix-ups. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Getting an article published on CodeProject should be easier and faster.
-
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: 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! Aaron
In Christ, Aaron Laws http://ProCure.com
Not sure if there is a way around that limitation. That is, I'm not sure there is a way to drag-drop a virtually unlimited number of files and have them processed via command line. Instead, however, you could modify the context menu that pops up when you select mutliple files and right click them. You could add an extra item that say something like "Process With MyApp". That command would then add all those paths to a text file and then you'd pass that text file (as a command-line argument) to MyApp.exe (it would then read all the paths from that text file). Never tried that myself though, so I'm not sure if there would be any problems with doing it that way.
-
you should not take 20 or more RX'es for a single patient, medical costs are skyrocketing as it is, nor mix pictures from different patients in a single run of some app, to avoid mix-ups. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Getting an article published on CodeProject should be easier and faster.
Dear Mr. Pattyn, Thanks! I'm anonymizing.
In Christ, Aaron Laws http://ProCure.com
-
Not sure if there is a way around that limitation. That is, I'm not sure there is a way to drag-drop a virtually unlimited number of files and have them processed via command line. Instead, however, you could modify the context menu that pops up when you select mutliple files and right click them. You could add an extra item that say something like "Process With MyApp". That command would then add all those paths to a text file and then you'd pass that text file (as a command-line argument) to MyApp.exe (it would then read all the paths from that text file). Never tried that myself though, so I'm not sure if there would be any problems with doing it that way.
Dear Mr. aspdotnetdev, Thanks for your suggestion. I'd hate to have to modify that menu.... I was hoping for a stand-alone app that didn't require a setup of any sort. Maybe I can make an alternate version... oh well.
In Christ, Aaron Laws http://ProCure.com
-
Raymond wrote:
If you are using the ShellExecute/Ex function, then you become subject to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.
Think about it, dragging files from Explorer and dropping them onto your application requires something to start the application. I would venture to suggest that Explorer uses
ShellExecute/Ex
to do just that, hence the 2048 character limit.It's time for a new signature.
Dear Mr. MacCutchan, Good catch. This doesn't exactly explain the fact that I was able to get 2,075 characters into the command line. Well, either way, I still have a limit, even if it's not the 2048 limit, that I'm hitting. Thanks for your comment.
In Christ, Aaron Laws http://ProCure.com