Reputation: 325
I have about 700 files that some batch files use them. after each process new generated files name will have the same name with a prefix. after running multiple running name of files will be long about 50 characters. In this situation other batch files cannot use generated files and an error is occurred that say "The system cannot find the file specified" but after reducing file name batch files run properly and without any error.
Although this problem exist in my computer in my friend computer all of batch files run properly on files with more than 60 character names.
I don't know how to solve this problem. Is there any configuration or solution for changing max file name characters in windows?
I should mention that windows let me have files with more than 50 characters but batch files does not operate properly on them and also I cannot change files name and compact them for some reason!
my computer system: win ultimate 7
my friend computer: win server
(I also tried on a different win server and does not work properly, and I am confused!)
part of batch files that produce error (and also many command such as it):
forfiles /p . /m .%%~ni. /c "cmd /c move @FILE .\%%~ni\@FILE"
error content:
The system cannot find the file specified.
Upvotes: 1
Views: 1274
Reputation: 2218
The problem does not come from the file name but from the full path name? You can not create a file with a path longer than 260 characters.
Check this article for more information.
So depending on where are located the file your script will successfully or not.
The solution (well this is more a workaround) is to put your files in a folder that is as closest as possible to the root of the disk.
Kevin
Upvotes: 1