Announcement

Collapse
No announcement yet.

How to rename output textfile to hostname.txt

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to rename output textfile to hostname.txt

    Hi all,


    I have this lil' batch script to collect some information from about 50 workstations. The script generates a text file in c:\ directory with > c:\textfile.txt. I need to rename that file to hostname.txt, but if I use the %hosname% variable the file is called %hostname%.txt of course. I need it to have the computername as filename, as it will be copied to a networkshare later on...

    How can I do that?

    (environment is a win2003 domain with mixed vista and xp pro clients, script will be run using gpo and manually in few cases)



    Thnx


    Lukas
    Last edited by Lukas; 2nd July 2008, 09:15. Reason: extra info

  • #2
    Re: How to rename output textfile to hostname.txt

    Hi Lukas

    Try the %Computername% variable.
    That should work.
    Caesar's cipher - 3

    ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

    SFX JNRS FC U6 MNGR

    Comment


    • #3
      Re: How to rename output textfile to hostname.txt

      Haha Thnx, it works.

      Comment

      Working...
      X