cmd help

Discussion in 'Windows XP / Older OS' started by lunar21, Sep 29, 2009.

  1. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    753
    270
    30
    hello everybody,

    I am trying to setup a bat file that will search for the computer name, then go to the corresponding point in that bat file. So for example, if the computers name is bill, I need the bat file to find the computers name (not just for bill), then go to the point that "bill" is listed in that file. I need this as I need to change computers (over 200), net configuration and i would like to have it done all by bat file. I know the code for the net config, just need the code for this. Please please please can someone help me :D.

    Lunar21
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. os2fan2

    os2fan2 MDL Novice

    Mar 3, 2009
    19
    0
    0
    You could use something like

    goto aa%Computername%


    :aa
    echo error - computername not set
    goto :end

    :aaMachine1
    echo Welcome to box 1
    goto :end

    :end
    rem cleanup stuff
     
  3. 911medic

    911medic MDL Guru

    Aug 13, 2008
    5,777
    504
    180
    #3 911medic, Sep 29, 2009
    Last edited by a moderator: Apr 20, 2017
    This will find the computer name and organization by querying the registry, then assign variables to them..

    If bill is the computername,
    Code:
    @echo off
    :begin
    goto %computername%
    
    :bill
    (net config)
    goto [wherever]
    
    :jim
    (netconfig)
    goto [wherever]
    
    
    :error
    echo       %computername% not in database. No changes made.
    pause
    exit
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...