@echo off
:home
cd c:/
IF EXIST "%PROGRAMFILES(X86)%" (set bit=x64) ELSE (set bit=x86)
title Log in to CMD
color f0
cls
echo.
echo Cmd Accounts
echo ======================================
echo.
echo [1] Log In (access existing Account)
echo.
echo [2] Register (add an account)
echo.
echo [3] Delete Account (remove an account)
echo.
echo ============Ethans Security===========
echo.
set RegisterVal=0
set DeleteAcc=0
set /p op=
if %op%==1 goto Login
if %op%==2 goto setReg
if %op%==3 goto setDel
goto home
:setReg
set RegisterVal=1
goto Login
:setDel
set DeleteAcc=1
goto Login
:Login
cls
cd c:/
mkdir enxlogin
cd enxlogin
cls
echo Cmd Login
echo ======================================
echo.
set /p logName="Enter your username:"
EditV64 -m -p 'Enter your Password:' logPass
EditV32 -m -p 'Enter your Password:' logPass
if exist %logName%.txt goto continue
cls
color fc
echo Cmd Login
echo ======================================
echo.
echo Acces Denied
pause
goto home
:continue
set /p var= <%logName%.txt
set actPass=%var%
call enx actPass actPass
if %logPass%==%actPass% goto logdone
color fc
cls
echo Cmd Login
echo ======================================
echo.
echo Acces Denied
pause
goto home
:Register
cd c:/
mkdir enxlogin
cd enxlogin
cls
echo Cmd Register
echo ======================================
echo.
set /p regName="Enter new username:"
set /p regPass="Enter new password:"
set regName=%regName%
set regPass=%regPass%
call enx regPass regPass
echo %regPass%>%regName%.txt
set regName=NUL
set regPass=NUL
cls
echo Cmd Register
echo ======================================
echo.
echo Acount Successfully Created
echo.
pause
goto home
:DelAccount
cd c:/
mkdir enxlogin
cd enxlogin
cls
echo Cmd Delete Account
echo ======================================
echo.
echo Account List
echo ------------
for %%a in ("c:\enxlogin\*") do @echo %%~na
echo.
echo Enter the Account you want to delete:
set /p deletingAcc="Account Name:"
if exist %deletingAcc%.txt goto delaccountnow
cls
echo Account not found
pause
goto DelAccount
echo Cmd Delete Account
echo ======================================
echo.
:delaccountnow
del %deletingAcc%.txt
cls
echo Cmd Delete Account
echo ======================================
echo.
echo Successfully Deleted Account
pause
goto home
:logdone
if %RegisterVal%==1 goto Register
if %DeleteAcc%==1 goto DelAccount
set Register=0
set actPass=NUL
set logPass=NUL
cls
echo Cmd Login
echo ======================================
echo.
echo Successfully logged in!
echo.
pause
color 0f
cd "%userprofile%\Desktop"
cls
exit
here's my batch password script it runs on startup of cmd or a batch file but when a user presses ctrl-c or ctrl-break it bypasses the login script
here's what happens I run cmd it starts up all works but when I press CTRL-C it exits and goes back to normal CMD so you can then mess with cmd this is suppost to be protecting people from messing with my cmd in a cool fasion
The Batch file below can not be cancelled by Ctrl-C, and if it is cancelled by Ctrl-Break the cmd.exe window is closed, so the user never get access to a normal cmd.exe command-line session via this Batch file.
@echo off
setlocal
if "%~1" equ "NonCancelable" goto NonCancelable
start "" /B cmd /C "%~F0" NonCancelable
exit
:NonCancelable
echo You can NOT cancel me!
echo/
set "var="
set /P "var=Enter password (enter Exit to end): "
if /I "%var%" neq "exit" goto :NonCancelable
echo Terminating non cancelable...
pause
exit