Skip to content

Instantly share code, notes, and snippets.

@cobinrox
cobinrox / deldir.bat
Created December 13, 2023 13:57
Delete directory, recursive
rmdir /s /q %1
@cobinrox
cobinrox / cdp.bat
Last active December 13, 2023 13:58
Change to a C:\gitprojects directory
@echo off
cd /d C:\gitprojects
cls
color 17
cmd /k
@cobinrox
cobinrox / mvn39.bat
Created December 13, 2023 13:55
Change maven to 3.9
@echo off
@REM Swap old MVN path/w newer version
@REM YOU MUST HAVE MVN VERSIONS AVAILABLE
@REM AND UPDATE THE oldHome and newHome VARIABLES BELOW
setlocal EnableDelayedExpansion
set oldHome=C:\apache-maven-3.8.8
set newHome=C:\apache-maven-3.9.6
set oldPath=!oldHome!\bin
@cobinrox
cobinrox / mvn38.bat
Created December 13, 2023 13:54
Change mvn to 3.8
@echo off
@REM Swap newer MVN path/w older version
@REM YOU MUST HAVE MVN VERSIONS AVAILABLE
@REM AND UPDATE THE oldHome and newHome VARIABLES BELOW
setlocal EnableDelayedExpansion
set newHome=C:\apache-maven-3.8.8
set oldHome=C:\apache-maven-3.9.6
set oldPath=!oldHome!\bin
@cobinrox
cobinrox / jdk17.bat
Last active December 13, 2023 13:53
Swap to JDK17
@echo off
@REM Swap old JDK path and JAVA_HOME for new JDK
@REM ASSUMES THAT JAVA_HOME IS DEFINED IN YOUR LOCAL USER ACCOUNT,
@REM NOT IN THE SYSTEM ACCOUNT
setlocal EnableDelayedExpansion
set newHome=C:\Program Files\Amazon Corretto\jdk17.0.8_8
set oldHome=C:\Program Files\Amazon Corretto\jdk11.0.14_10
set oldPath=!oldHome!\bin
set newPath=!newHOME!\bin
@cobinrox
cobinrox / jdk11.bat
Last active December 13, 2023 13:53
Swap to JDK11
@echo off
@REM Swap old JDK path and JAVA_HOME for new JDK
@REM ASSUMES THAT JAVA_HOME IS DEFINED IN YOUR LOCAL USER ACCOUNT,
@REM NOT IN THE SYSTEM ACCOUNT
setlocal EnableDelayedExpansion
set oldHome=C:\Program Files\Amazon Corretto\jdk17.0.8_8
set newHome=C:\Program Files\Amazon Corretto\jdk11.0.14_10
set oldPath=!oldHome!\bin
set newPath=!newHOME!\bin
@cobinrox
cobinrox / restorepath.bat
Last active December 4, 2023 14:12
Batch file to restore PATH from previously saved PATH
@echo off
setlocal enabledelayedexpansion
:: Read the contents of the file into a variable
set /p NEW_PATH=<c:\users\public\path.backup
:: Set the PATH environment variable
setx PATH "!NEW_PATH!"
@cobinrox
cobinrox / swappath.bat
Last active December 18, 2023 13:32
Batch file to swap out PATH entry, e.g. a JDK bin dir
@echo off
@REM Swap out an old subdir entry in the PATH env var with a new value
@REM Usage:
@REM swappath.bat someOldSubDir someNewSubDir
@REM
@REM Returns errorLevel 0 if swappage occurred, 1 otherwise
@REM
setlocal EnableDelayedExpansion
When viewing a POM file and trying to grok a plug-in purpose and execution, always ask: what phase and lifecycle is this plug in associated with?
@cobinrox
cobinrox / ff.bat
Last active June 17, 2023 18:04
.bat file for finding files
@REM Recursively find files in a specified dir with specified file name
@REM usage example:
@REM ff some\folder *.mp3
@REM Returns to the screen the list of files that met search file name.
@REM Also creates "paths.txt" and "names.txt" containing full path and
@REM just file name, respectively
@REM Inputs
@REM %1 directory to search
@REM %2 file name search string