How to prevent unknown laptop login access without password (Using a Simple Script)

How to prevent laptop login access without password

Sometimes, you just don’t want anyone else snooping around on your laptop. Sure, passwords are there, but what if you want an extra layer of fun security?

 Here’s a small VBScript code you can use to make your laptop shut down automatically if your secret folder isn’t found.

Sounds cool, right? Let’s see how it works...


The Magic Code

Here’s the script with simple comments so you understand it:
Or Dowload it here : Dowload File

Option Explicit ' Makes sure all variables are declared ' Step 1: Set your secret folder path here Dim folderPath folderPath = "C:\MySecretFolder" ' Step 2: Create FileSystemObject to check if the folder exists Dim fso Set fso = CreateObject("Scripting.FileSystemObject") ' Step 3: Wait for 10 seconds after startup WScript.Sleep 10000 ' Step 4: If the secret folder is missing, shut down the laptop If Not fso.FolderExists(folderPath) Then Dim shell Set shell = CreateObject("WScript.Shell") shell.Run "shutdown /s /t 1", 0, False End If

How This Works 

  1. Set Folder Path
    You decide on a secret folder location. Replace "path to folder"  with your own folder path.

  2. FileSystemObject (fso)
    The script checks if that secret folder exists on your laptop.

  3. Wait for 10 seconds
    The script pauses for 10 seconds after startup to give the system time to load.

  4. Shutdown Command
    If the folder doesn’t exist, the script immediately runs a shutdown command.


Steps to Use It

  1. Open Notepad and copy the code.

  2. Save it as security.vbs (make sure the file extension is .vbs).

  3. Place the file inside the Startup folder.

    • Press Win + R → type shell:startup → press Enter.

    • Copy your security.vbs file here.

  4. Create your secret folder in the path you set in the script.

  5. Done.

Now, every time someone turns on your laptop, the script will run. If your secret folder is missing (or deleted by someone), the system will shut down before they can log in.

A Friendly Warning ⚠️

Don’t delete or rename your secret folder by mistake, or you’ll lock yourself out too 😅. Always remember the folder path you set in the script.

Also Read 

Frequently Asked Questions (FAQ)

Q 1: What if I forget or delete the secret folder?

If you delete or rename the secret folder, your laptop will keep shutting down. To fix it, start your laptop in Safe Mode, remove the security.vbs file from the Startup folder, and then restart.


Q 2: Can this script protect my laptop from hackers?

No . This is more like a fun security trick or prank. Real hackers can bypass it. For serious protection, always use a strong password, encryption, and antivirus.