Windows Script for Networking

Status
Not open for further replies.

sandman3838

Distinguished
Oct 22, 2010
28
0
18,530
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
:prompt
color 1f
cls
:eek:ptions
cls
echo =====================
echo MENU OPTIONS :
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!
pause
goto:eek:ptions

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

:TRACERT
set /p host="Enter Host to tracert: "
tracert %host%"
pause
goto:eek:ptions

:exit
exit

====================================
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
 

sandman3838

Distinguished
Oct 22, 2010
28
0
18,530
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?
 
Solution
Status
Not open for further replies.