Find the directory path in batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 1
Joined: 18 Jul 2019 13:20

Find the directory path in batch

#1 Post by dos3.1 » 18 Jul 2019 13:23


Would you know why this does not work please?

dir . /b/s ^| findstr /R "\\$"
The syntax of the file, directory, or volume name is incorrect.

thanks in advance

Posts: 1819
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Find the directory path in batch

#2 Post by penpen » 18 Jul 2019 15:59

External dos commands like "findstr.exe" typically aren't able to open a file using an URI;
also most probable encoded URI's are also unsupported.

You have to map a network drive to a local volume like for example "Z:", using "net.exe" (and after you have finished your work, unmap it):

Code: Select all

:map network drive to Z:
:CAUTION: Make sure Z: is an unused volume label!
net use z: \\remotepc\sharename

:do something with volume z:

:don't forget to unmap the network drive
net use z: /delete
If you need to set a user /password... then you might wnat to read:

Code: Select all

net use /?

Post Reply