Archived from groups: microsoft.public.windowsxp.general (More info?)
Hi i would like to know if there's a good place to learn about making
batch file because i don't know about the syntax. I only program in c,
delphi and Java.
What i would like to know is if it's possible to do a "while", "if"
(Conditions) and "read/write" text files so i can do a several test
like ping few computer in my buisness and be sure that they are well
connected by creating a file that after it read the name of the
computer it will ping and it pings it, write a file with the name of
this computer with a "ok" next to it if it worked and "Not connected"
if it can't ping it!
Archived from groups: microsoft.public.windowsxp.general (More info?)
Type if and for in help. Everything else is just what you type at a command prompt.
--
--------------------------------------------------------------------------------------------------
http://webdiary.smh.com.au/archive [...] 01075.html =================================================
"Esteban" <wasa_79@hotmail.com> wrote in message news:1121781159.155320.65560@o13g2000cwo.googlegroups.com...
> Hi i would like to know if there's a good place to learn about making
> batch file because i don't know about the syntax. I only program in c,
> delphi and Java.
>
> What i would like to know is if it's possible to do a "while", "if"
> (Conditions) and "read/write" text files so i can do a several test
> like ping few computer in my buisness and be sure that they are well
> connected by creating a file that after it read the name of the
> computer it will ping and it pings it, write a file with the name of
> this computer with a "ok" next to it if it worked and "Not connected"
> if it can't ping it!
>
> Thanks helping me with batch file programming!
>
> Esteban (sorry my english)
>
Archived from groups: microsoft.public.windowsxp.general (More info?)
Esteban wrote:
> Hi i would like to know if there's a good place to learn about making
> batch file because i don't know about the syntax. I only program in c,
> delphi and Java.
>
> What i would like to know is if it's possible to do a "while", "if"
> (Conditions) and "read/write" text files so i can do a several test
> like ping few computer in my buisness and be sure that they are well
> connected by creating a file that after it read the name of the
> computer it will ping and it pings it, write a file with the name of
> this computer with a "ok" next to it if it worked and "Not connected"
> if it can't ping it!
>
> Thanks helping me with batch file programming!
Hi,
Below is a batch file that should do what you want.
The computerlist.txt file needs to have one computer name
on each separate line.
--------------------8<----------------------
@echo off
setlocal
set inputfile=computerlist.txt
set resultfile=results.txt
del "%resultfile%"
for /F "tokens=*" %%a in (%inputfile%) do call ing %%a
GOTO :EOF
ing
set connected=N
for /f "Tokens=*" %%b in ('ping.exe -n 1 %1 ^|find.exe "TTL="') do (
set connected=Y
)
if "%connected%" EQU "Y" echo %1 OK >> "%resultfile%"
if "%connected%" EQU "N" echo %1 Not connected >> "%resultfile%"
GOTO :EOF
Archived from groups: microsoft.public.windowsxp.general (More info?)
"Esteban" <wasa_79@hotmail.com> wrote in message
news:1121781159.155320.65560@o13g2000cwo.googlegroups.com...
> Hi i would like to know if there's a good place to learn about making
> batch file because i don't know about the syntax. I only program in c,
> delphi and Java.
>
> What i would like to know is if it's possible to do a "while", "if"
> (Conditions) and "read/write" text files so i can do a several test
> like ping few computer in my buisness and be sure that they are well
> connected by creating a file that after it read the name of the
> computer it will ping and it pings it, write a file with the name of
> this computer with a "ok" next to it if it worked and "Not connected"
> if it can't ping it!
>
> Thanks helping me with batch file programming!
>
> Esteban (sorry my english)
>
You are about to answer a thread that has been inactive for more than 6 months. If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.