How to create a Password Protected Command Prompt in windows10 ?

Command Prompt is a command-line interpreter application available in most Windows operating systems. It’s used to execute entered commands.  You can copy, move, and delete files, and even create undeletable folders. The command prompt used to be the only way to interact with the computer, so a simplistic set of commands with rigid syntax was used in order to make the system do anything. This made it virtually “idiot-proof,” although it also makes it difficult to use without experience and knowledge. Using the command prompt we can create an automated script. These scripts are called as Batch files. we can create batch files to invoke a command n number of times.  In this article, I’m going to show how to create a password-protected command prompt in windows 10.

Steps to make Password Protected Command Prompt:

  • Open Notepad on your Windows machine.
  • Copy and paste the code mentioned below and save it as Login.bat

@echo off :home title Log in to CMD color 07 cls echo. echo Cmd Accounts echo ============= echo. echo [1] Log In echo [2] Sign Up echo [3] Exit echo. set /p op= if %op%==1 goto 1 if %op%==2 goto 2 if %op%==3 goto 3 goto error :2 cls echo Sign Up echo ====================================== echo. set /p newname=”Enter new username:” if “%newname%”==”%newname%” goto inputname :inputname cd “%userprofile%\documents” if exist “cmdacoBin” goto skip if not exist “cmdacoBin” goto noskip :noskip md “cmdacoBin” goto skip :skip cd “%userprofile%\documents\cmdacoBin” if exist “%newname%.bat” goto namexist if not exist “%newname%.bat” goto skip2 :skip2 echo set realusername=%newname%> “%newname%.bat” goto next :next echo. set /p pswd=Enter new Password: if “%pswd%”==”%pswd%” goto inputpass :inputpass cd “%userprofile%\documents\cmdacoBin” echo set password=%pswd%>> “%newname%.bat” goto next1 :namexist echo. echo The entered username already exists. echo Press any key to return. . . pause >nul goto 2 :next1 cls echo Cmd Accounts echo ============ echo. echo Your account has been successfully created! echo. pause goto home :1 color 07 cls echo Cmd Accounts Log In echo ================================ echo. Set /p logname=Username: if “%logname%”==”%logname%” goto 2.1 :2.1 echo. set /p logpass=”Password:” if “%logpass%”==”%logpass%” goto login :login cd “%userprofile%\documents\cmdacoBin” if exist “%logname%.bat” goto call if not exist “%logname%.bat” goto errorlog :call call “%logname%.bat” if “%password%”==”%logpass%” goto logdone goto errorlog :errorlog color 0c echo. echo Username or Password incorrect. echo Access denied. pause >nul goto home :logdone cls echo Command Prompt echo ============== echo. echo Successfully logged in! echo. pause goto account :account cls cd “%userprofile%\documents\cmdacoBin” call “%realusername%color.bat” call “%realusername%.bat” color %colorcode% cls echo. echo ——————————————————————————- echo %realusername% echo ——————————————————————————- @echo off break off Title Command Prompt color 0a cls echo Type “home” any time to go to the current user profile directory. echo Type “desktop” any time to go to the current user desktop. echo. echo Type help to see list of common commands like cd, rd, md, del, echo ren, replace, copy, xcopy, move, attrib, tree, edit, and cls. echo Type [command]/? for detailed info. echo. pause cls :cmd echo Directory: %CD% set /P CMD=Command: if “%CMD%” == “cls” goto cls if “%CMD%” == “home” goto home2 if “%CMD%” == “desktop” goto desktop if “%CMD%” == “red” goto red if “%CMD%” == “green” goto green if “%CMD%” == “normal” goto normal %CMD% cd C:\ goto cmd :cls cls goto cmd :home2 cd /d %USERPROFILE% cls goto cmd :desktop cd /d %SystemDrive%\Users\%USERNAME%\Desktop cls goto cmd :red color 0c cls goto cmd :green color 0a cls goto cmd :normal color 07 cls goto cmd

  • Now open the login.bat file.

Here you will see three options login, signup, exit. To log in, you have to signup first. enter into option 2 and give the username and password. Now you are ready to log in. After logging in you can execute your own command. Password Protected Command-technoresult Password Protected Command-technoresult

2 thoughts on “How to create a Password Protected Command Prompt in windows10 ?”

  1. I followed the above instructions, however command prompt would only open for a split second before closing. No menu would appear. How do I fix it?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top