Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kodybrown's full-sized avatar
💭
I may be slow to respond.

Kody Brown kodybrown

💭
I may be slow to respond.
View GitHub Profile
@kodybrown
kodybrown / example_usage.txt
Created July 31, 2019 23:48
batch file boilerplate template
>template.bat /?
test v1.23
This is a sample batch file template,
providing command-line arguments and flags.
USAGE:
test.bat [flags] "required argument" "optional argument"
/?, --help shows this help
/v, --version shows the version
@kodybrown
kodybrown / launch.bat
Created October 9, 2019 03:09
Launch random .URL file
@setlocal EnableDelayedExpansion
@echo off
set "SourceDir=."
REM count the number of files
pushd "!SourceDir!"
set /a FileCount=0
for /f "usebackq delims=|" %%I in (`dir /a-d-s-h /b *.url`) do set /a FileCount+=1
popd
@kodybrown
kodybrown / launch.bat
Created July 31, 2019 23:44
launch random .url file
@setlocal EnableDelayedExpansion
@echo off
set "SourceDir=."
REM count the number of files
pushd "!SourceDir!"
set /a FileCount=0
for /f "usebackq delims=|" %%I in (`dir /a-d-s-h /b *.url`) do set /a FileCount+=1
popd
@kodybrown
kodybrown / err.bat
Last active July 15, 2016 18:42
Batch file that tests setting a non-zero (error) and a 0 (success) errorlevel
@echo off
dir "%temp%" >NUL
echo err %errorlevel%
dir "c:\doesnotexist" >NUL 2>&1
echo err %errorlevel%
dir "%temp%" >NUL
echo err %errorlevel%