whats wrong with this batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
C_Hickman
Posts: 2
Joined: 22 Sep 2011 17:33

whats wrong with this batch file

#1 Post by C_Hickman » 22 Sep 2011 17:37

@echo off
echo _ _ _
echo ___| |__ __ _ _ __ __| | | ___ _ __
echo / __| '_ \ / _` | '_ \ / _` | |/ _ \ '__|
echo (__| | | | (_| | | | | (_| | | __/ |
echo \___|_| |_|\__,_|_| |_|\__,_|_|\___|_|
pause
end

im new to batch. the text is a bit off in the typing above. im looking for it to display my ascii art but then pause at the end. if you can also tell me how to make it wait a few seconds before going to the next line

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: whats wrong with this batch file

#2 Post by Ed Dyreen » 22 Sep 2011 18:24

'

Code: Select all

@echo off

echo._ _ _
>nul 2>&1 ping 0.0.0.0
echo.___^| ^|__ __ _ _ __ __^| ^| ^| ___ _ __
>nul 2>&1 ping 0.0.0.0
echo./ __^| '_ \ / _` ^| '_ \ / _` ^| ^|/ _ \ '__^|
>nul 2>&1 ping 0.0.0.0
echo.(__^| ^| ^| ^| (_^| ^| ^| ^| ^| (_^| ^| ^| __/ ^|
>nul 2>&1 ping 0.0.0.0
echo.\___^|_^| ^|_^|\__,_^|_^| ^|_^|\__,_^|_^|\___^|_^|
>nul 2>&1 ping 0.0.0.0

echo.
echo.'^|' is a special command; it takes stdout of previous command,
echo.spawns a new instance and sets stdin accordingly.

echo.echo.This works ^|findstr /lic:"works"
echo.This works |findstr /lic:"works"

pause
exit /b

C_Hickman
Posts: 2
Joined: 22 Sep 2011 17:33

Re: whats wrong with this batch file

#3 Post by C_Hickman » 22 Sep 2011 18:56

it worked, thanks, is there a way to make the delay a little shorter?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: whats wrong with this batch file

#4 Post by Ed Dyreen » 22 Sep 2011 19:26

'

Code: Select all

@echo off

echo. -n option can be used as multiplier default = 4 x 1000ms = 4000ms
>nul 2>&1 ping /n 1 "0.0.0.0"

ping /?

pause
exit /b

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: whats wrong with this batch file

#5 Post by nitt » 23 Sep 2011 16:19

Ed Dyreen wrote:'

Code: Select all

@echo off

echo. -n option can be used as multiplier default = 4 x 1000ms = 4000ms
>nul 2>&1 ping /n 1 "0.0.0.0"

ping /?

pause
exit /b


What...?

Why not just use the IP address 0 and send the output to nul?

Code: Select all

@echo off
echo Waiting . . .
ping 0 -n 5 > nul

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: whats wrong with this batch file

#6 Post by Ed Dyreen » 23 Sep 2011 16:38

'
Why not just use the IP address 0 and send the output to nul?
Indeed, if you have a network-card AND have the TCP-IP driver running. :)
In case our bro is less fortune, may want to > both stderr&stdout > nul.

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: whats wrong with this batch file

#7 Post by nitt » 23 Sep 2011 16:52

Ed Dyreen wrote:'
Why not just use the IP address 0 and send the output to nul?
Indeed, if you have a network-card AND have the TCP-IP driver running. :)
In case our bro is less fortune, may want to > both stderr&stdout > nul.


But we aren't actually pinging an IP. That's why I use 0 instead of like 0.0.0.0, and stuff like that. Every time it pings, it will be unsuccessful. The command doesn't matter, nor what it returns.
And I also don't get how using ">nul 2>&1" like that has anything to do with your network card. It's just syntax...

You'd have to explain, because I don't get what you mean.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: whats wrong with this batch file

#8 Post by Ed Dyreen » 23 Sep 2011 17:03

'
Disable your network hardware or TCPIP-protocol and see what happens on stderr. :?
Last edited by Ed Dyreen on 23 Sep 2011 18:28, edited 5 times in total.

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: whats wrong with this batch file

#9 Post by nitt » 23 Sep 2011 17:19

Ed Dyreen wrote:'
Disable your network hardware or TCPIP-protocol and see what happens on stderr. :?


I wish you could just tell me.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: whats wrong with this batch file

#10 Post by Ed Dyreen » 23 Sep 2011 18:28

'
nitt wrote:But we aren't actually pinging an IP. That's why I use 0 instead of like 0.0.0.0, and stuff like that. Every time it pings, it will be unsuccessful. The command doesn't matter, nor what it returns.
And I also don't get how using ">nul 2>&1" like that has anything to do with your network card. It's just syntax...
But we ARE actually pinging an IP, the command does matter, if it didn't we could just use echo. ">nul 2>&1" has nothing to do with your network card. It has to do with the output of the command they operate on. Ping however has everything to do with your network card.

I know of 2 cases where ping will complain, one being that you don't have at least one MAC and the second that the required driver isn't running. ( How would ping be able to ping if it doesn't know how ? ) The reason I direct stderr to null is because I don't wan't to be notified of unhandled errors.

Captcha142
Posts: 13
Joined: 18 Sep 2011 23:35

Re: whats wrong with this batch file

#11 Post by Captcha142 » 23 Sep 2011 21:45

To be more specific in the time delayed can't you

Code: Select all

ping 192.168.1.1 -n 1 -t 500>NUL


for 500 ms?

Or is this not exactly foolproof/anyone have problems with this?

Post Reply