Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- if "%~1" == "" goto checkinst
- del %1 2>nul
- echo Enter subfolders to create. e.g.: sub dir\another sub dir\and more...
- set /p dirs=
- set dirs=%dirs%
- if "%dirs%" == "" (
- echo Aborted.
- pause
- goto :eof
- )
- md %~dp0\%dirs%
- if %errorlevel% == 0 echo Subfolders successfully created.
- pause
- goto :eof
- :checkinst
- reg query hkcr\.subdirs /v "" 2>nul >nul
- if %errorlevel% == 0 goto uninst
- choice /n /m "Subfolders Maker is not yet installed. Install it now [Y/N]?"
- if %errorlevel% == 2 goto :eof
- if %errorlevel% == 0 goto :eof
- reg add hkcr\.subdirs /v "" /d subdirs >nul
- if errorlevel 1 (
- pause
- goto :eof
- )
- reg add hkcr\.subdirs\shellnew /v command /d "%~f0 ""%%1""" >nul
- reg add hkcr\subdirs /v "" /d Subfolders >nul
- echo Subfolders Maker has been installed.
- echo Use the "New > Subfolders" right-click popup menu to create subfolders.
- echo Reopen Explorer window if the "Subfolders" menu item is not shown.
- pause
- goto :eof
- :uninst
- choice /n /m "Subfolders Maker is already installed. Uninstall it now [Y/N]?"
- if %errorlevel% == 2 goto :eof
- if %errorlevel% == 0 goto :eof
- reg delete hkcr\.subdirs /f >nul
- if errorlevel 1 (
- pause
- goto :eof
- )
- reg delete hkcr\subdirs /f >nul
- echo Subfolders Maker has been uninstalled.
- choice /n /m "Delete this batch file too [Y/N]?"
- if %errorlevel% == 2 goto :eof
- if %errorlevel% == 0 goto :eof
- start "" /min cmd.exe "/c timeout 1 & del "%~f0""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement