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. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #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

  4. #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
  •