Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
@echo offecho hiya 1>doesntexist\blabla.txt 2>error.txt
c:\> test.batThe system cannot find the path specified
I believe the bushes in my yard will BURN before God picks up a PC to send a message
@echo off
IF %errorlevel% NEQ 0 ECHO error %errorlevel% occurred>error.txt
@macdad-: ...should there have been a fullstop/period between "errors" and in batch files". If that's the case, I understand.
CMD always displays the errors in batch files, whenever it hits an error, it terminates the batch file
@echo offclspushd doesntexist\dir /a-d
Pushd doesntexist\ || echo Error: Pushd failed - job terminated. && exit/b
@echo offecho hiya > doesntexist\blabla.txt
S:\>test.batThe system cannot find the path specified.S:\>
S:\>test.bat > err.txtThe system cannot find the path specified.S:\>
S:\>test.bat 2> err.txtS:\>
The system cannot find the path specified.
something > myfile.txt 2>&1
is the simplest way I can think of putting it
1) it won't continue reading the current line ">myfile.txt 2>&1"
(echo hello > \notexistdir\file.txt) 2>error.txt
2>error.txt (echo hello > \nodir\nofile.txt)
(echo line 1echo line 2echo line 3) > output.txt
> output.txt (echo line 1echo line 2echo line 3)
> output.txt echo Hello!
(ECHO hiya >doesnotexist\notextfile.txt) 2>error.txt
ooops Sorry, but you edited it twice, so I thought you meant the first edit.....my badThanksTwo-Eyes