The filename or extension is too long. MAX_PATH exceeds

1k Views Asked by At


I have one file search API, using the API I have searched for a file to find the location the API returns the file location which the path length is more than 256 characters. When I try to go through the location using CMD I got the error as

The filename or extension is too long.

The file path which I got is :

C:\$Recycle.Bin\S-1-5-21-774840990-364896907-44334205-1000\$RJBIKOB\logs
- Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\logs - Copy\logs\agent

I dont know how to go through the file location using CMD to run DIR command in the above file location. I have read many articles in stackoverflow in those articles said many command to solve this error but no use.

The following commands which all tried:

1) SUBST
2) \\?\ (UNC path) when I use this command and execute I got the following error in CMD.

CMD does not support UNC paths as current directories.

Can any one help me in this?

Thanks in advance

0

There are 0 best solutions below