Batch file

Forum Windows XP : Windows XP General Discussion - Batch file

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

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!

Thanks helping me with batch file programming!

Esteban (sorry my english)

Sponsored Links
Register or log in to remove.

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

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I can't type anything in Ms-Dos Edit batch file program!(Edit.exe)

Reply to Esteban

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

Esteban wrote:
> I can't type anything in Ms-Dos Edit batch file program!(Edit.exe)

At the command prompt, type:

%systemroot%\hh.exe Ms-its:%systemroot%\help\ntcmds.chm::/ntcmds.htm

And you will learn more than you want to know.

Or, again at the command prompt, type "Help" Thereafter, type
"Help/{command}," i.e., "HELP/SUBST"

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

Howdie,

Esteban <wasa_79@hotmail.com> schrieb/wrote:
> I can't type anything in Ms-Dos Edit batch file program!(Edit.exe)

Why do you use edit.exe?
Use cmd.exe instead.

Regards,

Peter Forster
MVP Windows Server Networking
Austria

Reply to Anonymous

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 :Ping %%a
GOTO :EOF

:Ping
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

endlocal
--------------------8<----------------------


Some batch file/command line resources:

The newsgroup microsoft.public.win2000.cmdprompt.admin is a very
good newsgroup for batch and command line questions.

Windows Scripting and Batch Programming Resources:
http://www.labmice.net/scripting/default.htm

Steve Hardy's web site
http://www.seanet.com/~shardy/ntscript.html

Batfiles. The DOS batch file programming handbook & tutorial:
main site: http://home7.inet.tele.dk/batfiles/
mirror: http://members.fortunecity.com/batfiles/
mirror: http://www.angelfire.com/blues/batfiles/


JSI FAQ, Windows NT / 2000 / XP Tips, Tricks, Registry Hacks and more...
http://www.jsiinc.com


Batfile links:
http://home7.inet.tele.dk/batfiles/main/links.htm
http://www.uwasa.fi/~ts/http/http2.html#batch
http://dmoz.org/Computers/Software [...] ges/Batch/


A newsgroup search is also an incredible source of information :-)

You can use http://groups.google.com/advanced_group_search to search
in a news database having articles dated back to all the way to 1981.

Batch programming and command line newsgroups ideal for newsgroup
searches:

alt.msdos.batch
alt.msdos.batch.nt
microsoft.public.win2000.cmdprompt.admin




--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/s [...] fault.mspx

Reply to Anonymous

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 could try these newsgroups

microsoft.public.win2000.cmdprompt.admin
alt.msdos.batch

but probably the best would be

alt.msdos.batch.nt

HTH

....Bill

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Batch file
Go to:

There are 1138 identified and unidentified users. To see the list of identified users, Click here.

Please mind

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.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them