Esteban

Distinguished
May 13, 2004
14
0
18,510
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)
 
G

Guest

Guest
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"
 
G

Guest

Guest
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
 
G

Guest

Guest
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/Operating_Systems/x86/DOS/Programming/Languages/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/scriptcenter/default.mspx
 
G

Guest

Guest
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
 
G

Guest

Guest
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/archives/_comment/001075.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)
>