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
:: Example Usage for the Shortcut function. | |
:: Create a shortcut in batch using WSH. | |
:: by David Ruhmann | |
:: Hide Commands | |
@echo off | |
:: Isolate Scope | |
setlocal |
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
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:AppendHex <xReturn> <xInput> | |
:: Append a hexidecimal number to the end of the input. | |
:: 1. Generate Random Number = 0-15 | |
:: 2. Convert Number to Hexidecimal | |
:: 3. Append to Input | |
setlocal | |
set /a "xValue=%RANDOM% %% 16" | |
if "%xValue%"=="10" set "xValue=A" | |
if "%xValue%"=="11" set "xValue=B" |
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
:: Batch Code Line Debugging | |
:: Retrieve the batch file line number where the Line function is called. | |
:: by David Ruhmann | |
:: Hide Command and Isolate Scope | |
@echo off | |
setlocal | |
:: Usage Example | |
call :False xResult |
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
:: Detect if Delayed Expansion or Command Extensions is supported. | |
:: Identify if delayed expansion is supported and handle both scenarios. | |
:: by David Ruhmann | |
:: Hide Commands | |
@echo off | |
rem setlocal /? | |
rem VERIFY OTHER 2>nul | |
rem SETLOCAL ENABLEEXTENSIONS |
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
:: Parse Example | |
:: Set a variable for each parameter flag to the value. flag:value, xflag=value | |
:: by David Ruhmann | |
:: Hide Commands | |
@echo off | |
:: Initilize Example | |
set "xParams=%*" | |
echo.%* |
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
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:Log <xLog> <xMessage> [xParrot] [xSession] | |
:: Append the message with a timestamp out to the specified log file and repeat | |
:: the message to the display if xParrot is set to 1. | |
if not "%~1"=="" if exist "%~1" echo.%Date% %Time% %~4: %~2 >> "%~1" | |
if /i "%~3"=="1" echo.%~2 | |
goto :eof | |
:: by David Ruhmann |
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
:: Get and Verify the version of Windows | |
:: by David Ruhmann | |
:: Hide Commands | |
@echo off | |
echo. | |
call :WindowsVersion xMajor xMinor | |
echo.%xMajor% | |
echo.%xMinor% |
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
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:IsDecimal <xReturn> <xInput> [xDelims] | |
:: Return true if the input is a decimal 10.0 number, else return false. | |
:::: Only allows for period seperator unless specified by xDelims. ,[tab][space] | |
call :IsNumber %1 %2 %3 | |
goto :eof | |
:: by David Ruhmann |
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
:: Determine if a Variable name is defined with a value. | |
:: by David Ruhmann | |
:: Hide Commands | |
@echo off | |
setlocal ENABLEEXTENSIONS | |
:: Example Usage | |
set "xVar=Value" | |
call :IsDefined xResult xVar |
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
:: Hide Command | |
@echo off | |
set "xResult=" | |
::if exist "Output.xml" del /f /q "Output.xml" | |
call :ReplaceWith xResult "Source.xml" "<Tools>" "Input.xml" "Output.xml" | |
echo.%xResult% | |
goto End |
OlderNewer