Last active
May 26, 2021 09:58
-
-
Save scanbix/6f7920ef4e8df4527d568e77f1011ea9 to your computer and use it in GitHub Desktop.
Windows batch snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Empty file | |
copy /y NUL EmptyFile.txt >NUL | |
:: Error handling | |
somecommand > log.txt 2>&1 | someothercommand | |
somecommand 2>&1 | someothercommand | |
:: Check if file exists | |
if exist \\somefile.txt ( | |
echo file exists | |
exit /b 0 | |
) else ( | |
echo file doesn't exist | |
exit /b 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment