Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    use hostname in win2000 batch file

    Good morning. There is a nslogfile.txt on our windows 2000 servers under (c:diags) I would like to create a batch file that would copy that file to the A: drive with a new name consisting of the hostname-(hyphen)nslogfile.txt. Is this possible? Thank you. -scott

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: use hostname in win2000 batch file

    Should be fairly simple in a BAT file. There is a built in system variable called COMPUTERNAME, so when you copy the file, use the syntax:
    <pre>copy c:diagsnslogfile.txt "a:%computername%-nslogfile.txt"</pre>

    Try that and see if it works.
    -Mark

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: use hostname in win2000 batch file

    Worked perfectly. Thank you.

Posting Permissions

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