-
Batch File Help
I want to connect to other computers on network to seach its hard drive to see if a file exist. This will be done over LAN.
Example:
A) a text file contains a list of computer names
computer1, computer2, computer3
B) I want batch to search C:\winnt\ for a file called mytext.txt
C) if mytext.txt exists I want it to print the name of the computer to a text file.
Any help...?
-
well there are alot of pitfalls that you may have to overcome... one of which is firewalling, another is sharing the root of a drive. These things your batch file will not be able to do.
If I understand B) correctly you want to search the computer on the lan's C\winnt not the local one.
IF EXISTS \\computername\sharename\directory\filename
is the code you need.
You will then need something to check the ERRORLEVEL that dos returns if it does or does not exist.
breakdown of batch file commands here
and all other dos commands here
-
I know you said bat file... but if you were doing it manually, you could try:
net use e: \\computername\c$
e:\
dir mytext.txt /s
"e:" is an arbitrarily chosen drive letter to which you are mapping the root of C: on the remote computer. To do this, you need administrative rights on the remote computer or on the domain.
dir /s is a directory list search command.