Batch file to match the computer name and continue based on computer name RRS feed

  • Question

  • I need to run a code block ONLY IF THE Computer name is identied as a AB or AC

    FOR /F "tokens=* USEBACKQ" %%F IN (`echo %ComputerName%`) DO (




    I take the computername to %COMPUTERNAME% variable

    if %COMPUTERNAME% == %AB% (

    Continue rest of the code ) ELSE (

    if %COMPUTERNAME% == %AC%  echo Stop it here


    Please help me with this.

    Best Regards,SQLBoy

    • Moved by Bill_Stewart Wednesday, December 12, 2018 9:27 PM This is not "scripts on demand"
    Monday, September 3, 2018 7:30 AM

All replies

  • if %COMPUTERNAME% == AB if %COMPUTERNAME% == AC (ping alpha)


    • Edited by jrv Monday, September 3, 2018 7:41 AM
    Monday, September 3, 2018 7:41 AM