Skip to content

Instantly share code, notes, and snippets.

View Archigos's full-sized avatar

AJ Phillips Archigos

  • Upstate New York
  • 00:18 (UTC -04:00)
View GitHub Profile
@Archigos
Archigos / removeempty.bat
Created July 29, 2014 14:37
Remove Empty Directories Except Number of Passes as Variable Ex: "removeempty 4"
@ECHO OFF
SET Executed=0
SET Run=1
IF "%~1" == "" (
SET ExecuteTotal=1
) ELSE (
SET ExecuteTotal=%~1
)
@Archigos
Archigos / iTunes.bat
Created July 29, 2014 14:46
Open iTunes
@ECHO OFF
PUSHD .
CLS
CD "C:\Program Files (x86)\iTunes\"
START iTunes.exe
POPD
EXIT /B
@Archigos
Archigos / Sublime.bat
Created July 29, 2014 14:48
Sublime Text 3
@ECHO OFF
TITLE Sublime Text 3
IF "%~1" == "" (
PUSHD .
START "Sublime" "C:\Program Files\Sublime Text 3\sublime_text.exe"
POPD
) ELSE (
START "Sublime" "C:\Program Files\Sublime Text 3\sublime_text.exe" "%~1"
)
@Archigos
Archigos / totalcmd.bat
Created July 29, 2014 14:48
Total Commander
@ECHO OFF
TITLE Total Commander
PUSHD .
CLS
CD C:\totalcmd\
START totalcmd64.exe
POPD && TITLE %COMSPEC%
@Archigos
Archigos / EditHosts.bat
Created July 29, 2014 14:50
Edit Windows "hosts" File Must be in an Administrative Prompt
@ECHO OFF
PUSHD.
CD C:\Windows\System32\Drivers\etc
START notepad hosts
POPD
@Archigos
Archigos / md5.bat
Created July 29, 2014 14:54
Create MD5 Hash of File Requires PHP to be installed.
@ECHO OFF && SETLOCAL ENABLEEXTENSIONS && SETLOCAL ENABLEDELAYEDEXPANSION
TITLE %COMSPEC% && COLOR 07
PUSHD . && CLS
IF "%~1" == "/?" GOTO Help ELSE GOTO Beginning
IF "%~1" == "" GOTO Help ELSE GOTO Beginning
:Beginning
ECHO.
PHP -r "print (md5('%~1'));"
@Archigos
Archigos / progressbar.bat
Created July 29, 2014 15:20
Add a progress bar to you batch files
REM Supplemental Batch File
REM Use 'CALL progressbar XX' in other scripts (where XX is a number 0 - 100)
REM Example: CALL progressbar 50
@ECHO OFF
:ProgressMeter
SETLOCAL ENABLEDELAYEDEXPANSION
SET ProgressPercent=%1
SET /A NumBars=%ProgressPercent%/2
@Archigos
Archigos / NirCmdCheck.bat
Created July 29, 2014 15:25
Check if NirCmd.exe installed on system, asks to download if missing
@ECHO OFF && SETLOCAL ENABLEEXTENSIONS && SETLOCAL ENABLEDELAYEDEXPANSION
TITLE %COMSPEC% && MODE CON COLS=200 LINES=68 && COLOR 07
PUSHD . && CLS
TITLE NirCmd Test
IF "%~1" == "/?" GOTO Help
IF "%~1" == "" GOTO Beginning
:: This begins comment block
@Archigos
Archigos / checkfile.bat
Created July 29, 2014 15:27
Get some basic information about a file
@ECHO OFF && SETLOCAL ENABLEEXTENSIONS && SETLOCAL ENABLEDELAYEDEXPANSION
TITLE %COMSPEC% && MODE CON COLS=200 LINES=68 && COLOR 07
PUSHD . && CLS
:: Test for Admin (Uncomment if you require them)
REM OPENFILES >NUL || ECHO Administrative Privileges Required
IF "%~1" == "/?" GOTO Help ELSE GOTO Beginning
IF "%~1" == "" GOTO Help
@Archigos
Archigos / say.bat
Created July 29, 2014 15:36
Use speech in your scripts (See NirCmdCheck gist for more info)
@ECHO OFF && nircmd setsysvolume 65535
GOTO Beginning
:: Start Comment Block
Have speech notifications in other scripts. Please note, all speech must be
phonetic so you may have to 'fudge' some spelling to make it sound correct.
Example, working with IIS on Windows, you may need to reference the IUSR account
and to do it correctly you'd use something like this:
Say "File permissions reset for I user account"