Batch File Help
Results 1 to 3 of 3

Thread: Batch File Help

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    11

    Question 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...?

  2. #2
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    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
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

  3. #3
    Registered User
    Join Date
    Jan 1999
    Location
    Canada
    Posts
    2,513
    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.
    Last edited by houseisland; November 14th, 2005 at 10:18 PM.

Similar Threads

  1. Edit the registry from a bat file
    By alistair91 in forum Windows XP
    Replies: 2
    Last Post: August 31st, 2004, 12:10 PM
  2. File/folder management
    By Cleetus in forum Tech-To-Tech
    Replies: 13
    Last Post: July 10th, 2003, 04:38 AM
  3. batch file help
    By sp3tiger in forum Windows NT/2000
    Replies: 3
    Last Post: January 18th, 2003, 01:11 PM
  4. [RESOLVED] Batch file question
    By gl993 in forum Tech-To-Tech
    Replies: 11
    Last Post: July 19th, 2001, 04:45 AM
  5. [RESOLVED] Batch file puzzler!!!
    By gl993 in forum Tech-To-Tech
    Replies: 1
    Last Post: December 5th, 2000, 06:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •