Batch script that takes drive letter input

LC14199

New member
Member
Local time
7:31 PM
Messages
20
Hey guys, since no one replied to my last thread because I don't think it was possible, so I'll make another one on a different perspective.

Instead of trying to make the drive letter the same, I would like the script to prompt the user for the drive letter and then input that into the script. I am having trouble coding this last piece of it, and if someone could please help me that'd be great :)
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP
OS
Windows 7 home Premium 64 bit
CPU
AMD A6
Memory
8 GB DDR3
Antivirus
MSE
Browser
Firefox/Chrome
Code:
cls
@ECHO OFF
set LOCKFOLDER=Locker
set PASSWRD=knight
title Folder %LOCKFODLER%
if EXIST "Locked" goto UNLOCK
if NOT EXIST %LOCKFOLDER% goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren %LOCKFOLDER% "Locked"
takeown /f "U:\Locked"
icacls "U:\Locked" /deny everyone:F
echo Folder locked
goto End
:UNLOCK
echo Enter the Password to unlock folder
set/p "pass=>"
if NOT %pass%== %PASSWRD% goto FAIL
icacls "U:\Locked" /grant everyone:F
takeown /f "U:\Locked"
ren "Locked" %LOCKFOLDER%
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md %LOCKFOLDER%
echo %LOCKFOLDER% created successfully
goto End
:End

Also, I've looked into an addon for cmd called EditVar which seems to be very helpful. If someone can show me the set/p code for such an idea stated in the OP, I'd be forever grateful :)
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP
OS
Windows 7 home Premium 64 bit
CPU
AMD A6
Memory
8 GB DDR3
Antivirus
MSE
Browser
Firefox/Chrome
Back
Top