Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
taripo
- Posts: 227
- Joined: 01 Aug 2011 13:48
#1
Post
by taripo » 16 May 2012 20:24
Code: Select all
C:\>(echo d | azacav) & echo f
'azacav' is not recognized as an internal or external command,
operable program or batch file.
azacav is a program that doesn't exist.. so can be any random string.
It exits, it doesn't get as far as executing echo f and displaying 'f'
Last edited by
taripo on 16 May 2012 21:43, edited 2 times in total.
-
Fawers
- Posts: 187
- Joined: 08 Apr 2012 17:11
-
Contact:
#2
Post
by Fawers » 16 May 2012 20:34
Try adding a pause to this code.
Edit:
Strange. I actually tried it. Pause has no effect.
But anyway, why would you want to pipe a command to a "random string"?
-
taripo
- Posts: 227
- Joined: 01 Aug 2011 13:48
#3
Post
by taripo » 16 May 2012 20:42
Why I want to try to run that line, is to ask anybody that might know, the question of what is going on, why it behaves like that.
It's obviously something about the way batch files work or interpret things. Or the shell. And i'm asking anybody that might know, the question of what's going on there.
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#4
Post
by foxidrive » 17 May 2012 01:13
It seems to me that cmd interpreter is parsing the line and halting on an error.
-
Squashman
- Expert
- Posts: 4465
- Joined: 23 Dec 2011 13:59
#6
Post
by Squashman » 17 May 2012 06:53
Code: Select all
H:\>(echo d | CALL azacav) & echo f
'azacav' is not recognized as an internal or external command,
operable program or batch file.
f
-
Ed Dyreen
- Expert
- Posts: 1569
- Joined: 16 May 2011 08:21
- Location: Flanders(Belgium)
-
Contact:
#7
Post
by Ed Dyreen » 19 May 2012 15:13
'
Not always, remember the cmd options /c and /k
'test.CMD'
Code: Select all
@echo off &start "CMD" %comspec% /k "%~dp0\test1.CMD" /ThisWorks &exit
'test1.CMD'
Code: Select all
@echo off &setlocal enableDelayedexpansion
(echo. |call azacav) &echo.yesyes
pause
exit
@dBenham used a fatal syntax error but yours is a logic error, whether it is fatal, depends on how your batch was started.
viewtopic.php?p=16359#p16359