Let the computer start

  
after inserting its own USB flash drive.

I did an experiment today, so that the computer can be started after inserting its own USB flash drive, otherwise it will automatically shut down after startup. The following is the implementation process of this method:
1 First determine the drive letter of the USB flash drive, you can plug your own USB flash drive, and then you can see the drive letter. This step is very important. If you mistake the drive letter, let your computer sleep.

2. Create a file in the USB flash drive, the file name and extension are arbitrarily entered, for example, the file created by the author is 123.lj;

3. Create a batch file on the local disk (Save as .bat with Notepad), its content is as follows:

if not exist I:\\123.lj shutdown -s -t 10 -c "You cannot use this computer"< Br>

Here I is the USB flash drive letter, this sentence means that if there is no 123.lj file in the USB flash drive, the computer will be turned off after 10 seconds and the prompt "You can not use this computer" is displayed. information.

4. Enter "gpedit.msc" in the run to open the group policy and locate the following path: "Local Computer" Policy → Computer Configuration → Windows Settings → Script (Start /Shutdown), then on the right Select the "Start" item in the box and add the batch file you just created to the list of startup scripts. OK and exit.

You are done here. At this time, you can only start the computer and enter the system when you turn on the USB flash drive. Otherwise, the following prompt will appear and the computer will be turned off within the specified time:

Message Tips

In addition, let's talk about the solution in the case of USB flash drive loss.

1. If there is enough time, you can enter "shutdown -a" in the run to release the shutdown command;

2. You can also start the script by deleting the computer into safe mode. Because the boot script is not loaded in safe mode.


Copyright © Windows knowledge All Rights Reserved