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
rompt
color 1f
cls
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" gotoING
if "%input%"=="2" goto:TRACERT
if "%input%"=="q" goto:exit
echo Please choose from the Options listed above!
pause
gotoptions
ING
set /p host="Enter Host to ping: "
ping "%host%"
pause
goto options
:TRACERT
set /p host="Enter Host to tracert: "
tracert %host%"
pause
gotoptions
: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
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
rompt
color 1f
cls
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" gotoING
if "%input%"=="2" goto:TRACERT
if "%input%"=="q" goto:exit
echo Please choose from the Options listed above!
pause
gotoptions
ING
set /p host="Enter Host to ping: "
ping "%host%"
pause
goto options
:TRACERT
set /p host="Enter Host to tracert: "
tracert %host%"
pause
gotoptions
: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