Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Command line not working when large

Command line not working when large

Scheduled Pinned Locked Moved C#
helpcomlinuxtutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LimitedAtonement
    wrote on last edited by
    #1

    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

    L L A 3 Replies Last reply
    0
    • L LimitedAtonement

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      L 1 Reply Last reply
      0
      • L LimitedAtonement

        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

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        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.


        L 1 Reply Last reply
        0
        • L LimitedAtonement

          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

          A Offline
          A Offline
          AspDotNetDev
          wrote on last edited by
          #4

          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.

          [Forum Guidelines]

          L 1 Reply Last reply
          0
          • L Luc Pattyn

            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.


            L Offline
            L Offline
            LimitedAtonement
            wrote on last edited by
            #5

            Dear Mr. Pattyn, Thanks! I'm anonymizing.

            In Christ, Aaron Laws http://ProCure.com

            1 Reply Last reply
            0
            • A AspDotNetDev

              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.

              [Forum Guidelines]

              L Offline
              L Offline
              LimitedAtonement
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • L Lost User

                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.

                L Offline
                L Offline
                LimitedAtonement
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups