Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 605883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:11:41+00:00 2026-05-13T17:11:41+00:00

I am stuck in the following script,Please Help ‘ Discover Current Drive Path curDrv

  • 0

I am stuck in the following script,Please Help

 ' Discover Current Drive Path
  curDrv = objFSO.GetParentFolderName(WScript.ScriptFullName) 'Drive Path
  ulpath = curdrv & "\Locker"
  propath = curdrv & "\Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
  passFile = curdrv & "\pass.txt"
  If objFSO.FolderExists (propath) Then call Unlock

  If Not objFSO.FolderExists (ulpath) Then
  objFSO.CreateFolder (ulpath) 
  MsgBox "Folder Created Successfully" , vbInformation, "Process Success"  & WScript.Quit
  end if
  If objFSO.FolderExists (ulpath) Then call Lock
  WScript.Quit

  Sub PassCreate
  PSCR = InputBox ("Type a password to lock folder.                          Do Not use blank password for your safety.")
  IF PSCR="" then MsgBox "Password cannot be blank" , vbCritical, "Faulty"  
  IF PSCR="" & objFSO.FileExists(passFile) then
  objFSO.DeleteFile(passFile)
  end if
  IF PSCR="" then call PassCreate 
  Set objFile = objFSO.CreateTextFile(passFile,True)
  objFile.Write PSCR & vbCrLf
  objFile.Close
  End Sub

  Sub Unlock
  PSW = InputBox ("Please Enter your 10 digit Password.               Example : 9867123456")
  Set objFile = objFSO.OpenTextFile(passFile)
  Do Until objFile.AtEndOfStream
  strLine= objFile.ReadLine
  Loop
  objFile.Close
 If not PSW=strLine Then MsgBox "Wrong Password" , vbCritical, "Illegal Operation" & WScript.Quit
 objFSO.MoveFolder propath , ulpath
 Set FO = objFSO.GetFolder(ulpath)
FO.Attributes = FO.Attributes AND 0 
MsgBox "Folder Unlocked Successfully" , vbInformation, "Success Operation" & WScript.Quit
End Sub 

 Sub Lock
 Message = "Are you Sure you want" & vbCr & vbCr
 Message = Message & "to Lock the folder ?" & vbCr & vbCr
 X = MsgBox(Message, vbOKCancel, "Confirmation")
 If not objFSO.FileExists (passFile) then call PassCreate

 Select Case X

 Case vbOK
 objFSO.MoveFolder ulpath , propath
 Set objFolder = objFSO.GetFolder(propath)
 Set FL = objFSO.GetFolder(propath)
 FL.Attributes = FL.Attributes XOR -1
 MsgBox "Folder Locked Sucessfully." , vbInformation, "Process Success"

Case vbCancel
MsgBox "Nothing Done." , vbExclamation, "Process Aborted"
End Select

End Sub 

Under sub passcreate if the password is blank first time nothing is written to the pass.txt so no password created.I want to prevent accidental blank password creation.I do not know how to cancel script execution if cancel is selected on the both the inputbox.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:11:42+00:00Added an answer on May 13, 2026 at 5:11 pm

    Why not ask for the password in a loop like this.

    PSCR = ""
    DO While PSCR = ""
        PSCR = InputBox ("Type a password to lock folder.                          Do Not use blank password for your safety.")
        IF PSCR="" then 
            MsgBox "Password cannot be blank" , vbCritical, "Faulty" 
        END IF 
    Loop
    

    That way the user would have to enter a password to continue running the script.

    EDIT:
    This should do everything you want.

    Sub TheScript
        password = GetPassword
        If password = "" Then Exit Sub
        MsgBox password
    End Sub
    
    Function GetPassword
        PSCR = ""
        DO While PSCR = ""
            PSCR = InputBox ("Type a password to lock folder. Do Not use blank password for your safety.")
            If IsEmpty(PSCR) Then 
                MsgBox "Cancel Pressed"
                Exit do            
            ElseIf PSCR = "" Then
                MsgBox "Password cannot be blank" , vbCritical, "Faulty"            
            End If
        Loop
        GetPassword = PSCR
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 287k
  • Answers 287k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Effective Java, chapter 5: Item 25: Prefer lists to arrays… May 13, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer I actually just started this project myself. It does almost… May 13, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer After some hours of research and testing I've discovered two… May 13, 2026 at 5:11 pm

Related Questions

I am trying to populate a select box (cities related to a state) using
I'm a beginner at Flex, and having the hardest time, working with Effects. Right
I have a YAML document like this: --- version: 1 rootdirectory: - subdirectory: -
My main question is how to copy a whole database having a English collation
I'm a stuck with the following function: <script type=text/javascript> function removeElement($parentDiv, $childDiv){ if (document.getElementById($childDiv))

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.