Batch file can't list files in server directory

Viewed 18

I'm new to the batch file scripting world and I'm trying to list the files of a server directory (my final goal is to search for a specific file within that folder -including subfolders-. I am only trying to list files just as a way of confirming that I am accessing the server folder) but I am stuck and don't know how to solve this.

This is my attemp

dir "\\server\folder\*" /b /a-d

I also tried "\\server\folder", "\\server\folder\*.*", \\server\folder to no avail.

I tried using this solution https://stackoverflow.com/a/14212254/19569763 but it throws an error about multiple connections (I the used net use to check and it returned "no connections")

I run the .bat file locally since I get a warning message if I try to do it within the server and I'm not risking the company server to do that.

Honestly, I haven't worked with servers before so I'm probably making multiple basic or stupid mistakes or I'm not considering certain things that are obvious to someone with experience here.

Can anyone help me?

0 Answers
Related