Windows Script for Networking

Good afternoon.
I have a Script Bach files that I run for getting information form PCs.
Some of how it all works in the BATCH file looks like this:

@echo off
color 1f
echo =====================
echo =====================
echo 1 PING
echo 2 TRACERT
echo =====================
echo Q - Quit
echo =====================
set /p input="Enter Options Here: "

if "%input%"=="1" goto:PING
if "%input%"=="2" goto:TRACERT
if "%input%"=="q" goto:exit
echo Please choose from the Options listed above!

set /p host="Enter Host to ping: "
ping "%host%"
goto options

set /p host="Enter Host to tracert: "
tracert %host%"


Ok now here is my issue!

With the above setup, at each entry I have to enter in the IP or Host name of the PC over and over.
Is it possible to switch it so that I get asked the IP or Hostname once and then be able to run "all" the commands in the menu from that single entry?

I guess I need an example to:

1 - Enter the IP/Host address
set /p input="What is the Host of the PC your working on?:"

2 - GOTO for each command to use the IP address that I just entered.

3 - I know I can close the Batch file to reset it, however is it possible to have a RESET option in the menu so that I can enter in the next IP/Host address?

Any help that you can throw my way would be great. Thank you
3 answers Last reply Best Answer
More about windows script networking
  1. This looks suspiciously like a class assignment.
  2. No Honestly! :) It's not really.
    I work at a IT Help Desk at a local bank and I haven't played around with scripts for almost 20 years.
    I not sure if one can get the initial IP to be used for all the commends and especially having someway to reset it for the next IP address?
  3. Best answer

    Call the batch with the IP address as a parameter.

    This link should help:

    Although, if all this script does is run those two commands, I really don't see the need for all that code. It's not that hard to type:




    probably much faster that way as well.
Ask a new question

Read More