bat to txt file

October 27, 2009 at 00:35:54
Specs: Windows Vista
Hi there

I recently started with bat files. And now i've managed to make a program that pings to the different servers. It keeps everything in a .txt file, so i know if there was a problem with one of the server. Now the only problem I got is the first variable is displaying "echo off(uit)".

I (think) already found a solution on this website. This happens if the variable doesnt have a value. But in my case it has one. Further in the file I compare this variable with another one and then it works. So could anyone help me please?

The code that is displaying a faulty result:
(it's %beginsrvdc1% that is giving an error)
@echo off

:algemeen

dir > c:\files\ping\serverping.txt
%SystemRoot%\system32\ping.exe srvdc1 > c:\files\ping\temp\srvdc1.txt
find /I "bytes=" c:\files\ping\temp\srvdc1.txt
if errorlevel 1 (
set beginsrvdc1=status:bad
echo Nieuwe sessie >> c:\files\ping\log\srvdc1.txt
echo %beginsrvdc1% >> c:\files\ping\log\srvdc1.txt
echo %date% %time% >> c:\files\ping\log\srvdc1.txt
echo. >> c:\files\ping\log\srvdc1.txt
) else (
if not errorlevel 1 (
set beginsrvdc1=status:goed
echo %beginsrvdc1%
echo Nieuwe sessie >> c:\files\ping\log\srvdc1.txt
echo %beginsrvdc1% >> c:\files\ping\log\srvdc1.txt
echo %date% %time% >> c:\files\ping\log\srvdc1.txt
echo. >> c:\files\ping\log\srvdc1.txt
)
)


(btw: sorry for my english)


See More: bat to txt file

Report •


#1
October 27, 2009 at 06:52:46
not a networking issue. please post in programming forum

Report •
Related Solutions


Ask Question