Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: computer name for batch file  (Read 3350 times)

0 Members and 1 Guest are viewing this topic.

kalasha

    Topic Starter


    Rookie

    computer name for batch file
    « on: December 06, 2008, 07:34:03 PM »
    good day,

    i have a batch file that uses the computer name(s) in various locations.  instead of making changes to the batch file, what i want to do is set the computer name as a variable everytime the batch is run and that variable is used for the vpn, folder, etc.

    there are various dos commands that get the name and other details, but is there one that gets just the computer name so that i can set it as a variable...

    ex.
    set folder=%date:~0,3% (sets the folder as Mon)

    xcopy "c:\..." "h:\%folder%\ (copys to destination folder Mon)

    what i am trying to do is get the computer name (A300SE) only as a variable like the folder is set to a date.  then that variable would be used as a login for the vpn and other locations in the batch.

    any suggestions.

    jat


    killerb255



      Adviser
    • Thanked: 35
      • Experience: Expert
      • OS: Windows 7
      Re: computer name for batch file
      « Reply #1 on: December 06, 2008, 08:13:13 PM »
      %computername%

      It's an enviroment variable.
      Quote from: talontromper
      Part of the problem is most people don't generally deal with computer problems. So for most they think that close enough is good enough.

      Steppingpanther



        Newbie

        Re: computer name for batch file
        « Reply #2 on: December 07, 2008, 04:57:28 PM »
        if you are asking what I think you are, which I thinking you want to do something like using a command in dos VPN %computername% .if this is what you want then you can use a line in the batch program like this: command %1 command being what command you want so in the end you would use the batch program like this: VPN computername