Page 1 of 1

what is the difference between 1> and 2>

Posted: 31 Mar 2024 10:46
by nnnmmm

Code: Select all

SET A1=%LocalAppData%Low
2>nul del /q "%A1%\MCC\Saved\Logs\cef3.log"
2>nul RMDIR /S /Q "%A1%\MCC\Temporary"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Crashes"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\webcache"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Config\CrashReportClient"

SET A1=%LocalAppData%Low
1>nul del /q "%A1%\MCC\Saved\Logs\cef3.log"
1>nul RMDIR /S /Q "%A1%\MCC\Temporary"
1>nul RMDIR /S /Q "%A1%\MCC\Saved\Crashes"
1>nul RMDIR /S /Q "%A1%\MCC\Saved\webcache"
1>nul RMDIR /S /Q "%A1%\MCC\Saved\Config\CrashReportClient"


what is the difference between 1>  and 2> , i didnt quite get this example i wrote long ago
(ECHO AAA) 1>"M:\111.TXT"
(ECHO BBB) 1>>"M:\111.TXT"
::(ECHO ccc) 2>"M:\111.TXT"
(ECHO DDD) 2>>"M:\111.TXT"
PAUSE
i forgot the difference between 1> and 2>
i want the errors not to be displayed when del or RMDIR doesnt find files
which is the correct one 1> or 2>?
few words would help

Re: what is the difference between 1> and 2>

Posted: 31 Mar 2024 14:48
by Squashman

Re: what is the difference between 1> and 2>

Posted: 31 Mar 2024 17:33
by nnnmmm

Code: Select all

this was the 1st time i tried, and redirection webpage was this way.
SET A1=%LocalAppData%Low
del /q "%A1%\MCC\Saved\Logs\cef3.log" 2>nul
RMDIR /S /Q "%A1%\MCC\Temporary" 2>nul
RMDIR /S /Q "%A1%\MCC\Saved\Crashes" 2>nul
RMDIR /S /Q "%A1%\MCC\Saved\webcache" 2>nul
RMDIR /S /Q "%A1%\MCC\Saved\Config\CrashReportClient" 2>nul


but i have seen people do something like this way and it was much more readable in one glimpse so i mimicked it. is there a way to do this?
SET A1=%LocalAppData%Low
2>nul del /q "%A1%\MCC\Saved\Logs\cef3.log"
2>nul RMDIR /S /Q "%A1%\MCC\Temporary"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Crashes"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\webcache"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Config\CrashReportClient"

Re: what is the difference between 1> and 2>

Posted: 01 Apr 2024 16:31
by ShadowThief
2 is for errors (STDERR), 1 is for everything else (STDOUT)

It doesn't matter if you put it at the front or the back of the command you're using it on, although there are a few edge cases where putting it at the front is better.

Re: what is the difference between 1> and 2>

Posted: 04 Apr 2024 07:33
by nnnmmm
>It doesn't matter if you put it at the front or the back

thanks, i will go back to this way
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Crashes"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\webcache"
2>nul RMDIR /S /Q "%A1%\MCC\Saved\Config\CrashReportClient"