Batch script that takes drive letter input


  1. Posts : 20
    Windows 7 home Premium 64 bit
       #1

    Batch script that takes drive letter input


    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


  2. Posts : 20
    Windows 7 home Premium 64 bit
    Thread Starter
       #2

    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


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:35.
Find Us