make bat cmd file as template 1. read ip by line 2. ping test 3. osql -i
- User
make bat cmd file as template
- read ip by line
- ping test
- osql -i
- Assistant
Certainly! Below is a simple batch script template that you can use to read IP addresses from a file, perform a ping test on each IP, and execute an SQL command using .
- User
@echo off setlocal
set "ip_file=ip_list.txt"
for /f "tokens=* delims=" %%i in (%ip_file%) do ( set "ip=%%i" ping -n 1 %1 -w 1000 >nul if %errorlevel%==0 ( osql -U TRANSF -P FSNART -Q "select 'my command'" pause ) )
exit /b 0
- Assistant
It seems you've provided a revised version of your script but with a few issues that can cause it to not work as intended. Let's correct these and ensure that it aligns with your requirements.