Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't my console app work with 25 arguments or more?

I am making a console application where I drop files onto the .exe from Explorer and it will move them to the appropriate folder based on rules I have set in the logic of the program.

The program works great, but when I select more than 25 files and drop them on my .exe I get an error:

Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.

If I only drop 24 files from the same set it works fine.

What am I doing wrong?

like image 422
Crash893 Avatar asked Dec 09 '22 20:12

Crash893


2 Answers

Depending on your platform, you may be running into the maximum command line length. See Here for more info.

"On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters."

like image 116
Adam Markowitz Avatar answered Dec 12 '22 10:12

Adam Markowitz


Is the number of files causing the maximum length of the command line (and thus arguments) to be exceeded, which causes this error?

like image 20
Rob Avatar answered Dec 12 '22 08:12

Rob