usb插入后自动启动程序_插入USB驱动器时如何自动运行Windows程序

usb插入后自动启动程序

usb插入后自动启动程序

Portable apps—self-contained executables that can be moved onto flash drives and run without installation—are popular tools for anyone who has to work on multiple Windows machines. If you want to make your workflow even faster, you can add an “auto-run” file that automatically opens the program as soon as you plug in the drive.

对于必须在多台Windows机器上工作的任何人来说,便携式应用程序(可以包含到闪存驱动器上并且可以不经安装而运行的自包含可执行文件)是受欢迎的工具。 如果要使工作流程更快,可以添加一个“自动运行”文件,该文件在插入驱动器后立即自动打开程序。

Unfortunately, starting with Windows 7, Microsoft restricted the autorun function for security purposes. There’s no practical way to get it back on every new machine, but it’s possible to do so on computers you have access to on a regular basis. First, you’ll need a small, third-party tool that monitors new USB drives for the autorun instruction. Then, you’ll need to create a simple autorun script file that sits on the USB drive and designates what program to run when you insert the drive.

不幸的是,从Windows 7开始,Microsoft出于安全目的限制了自动运行功能。 没有实用的方法可以将其恢复到每台新计算机上,但是可以在可以定期访问的计算机上进行恢复。 首先,您将需要一个小的第三方工具来监视新的USB驱动器的自动运行指令。 然后,您需要创建一个简单的自动运行脚本文件,该文件位于USB驱动器上,并指定在插入驱动器时要运行的程序。

第一步:在Windows PC上安装APO USB Autorun (Step One: Install APO USB Autorun on Your Windows PC)

APO USB Autorun is a program that monitors USB drives as they’re plugged in, looking for the legacy autorun.inf script file and launching any programs directed within. Download it from Softpedia here, then double-click the installer file and install it like any other program.

APO USB Autorun是一个程序,可在插入USB驱动器时对其进行监视,以查找旧版autorun.inf脚本文件并启动其中定向的任何程序。 从此处的Softpedia下载它 ,然后双击安装程序文件,然后像安装其他任何程序一样安装它。

After installation, whenever you connect a USB drive, you should see a window pop-up like the one below, asking if you want to run the program you’ve designated to run automatically (and we’ll talk more about how to do that part in a bit).

安装后,无论何时连接USB驱动器,您都应该会看到一个如下所示的弹出窗口,询问您是否要运行指定为自动运行的程序(我们将详细讨论如何执行该操作)部分)。

Just click the “Run” button to run the program and, optionally, disable the “Always ask before opening this file” option so that you aren’t bothered with this warning the next time you insert the drive.

只需单击“运行”按钮以运行该程序,然后有选择地禁用“在打开此文件之前始终询问”选项,这样您下次插入驱动器时就不会受到此警告的困扰。

Unfortunately, you’ll need to install APO USB Autorun on each Windows 7 or later PC that you want to autorun your USB drives. That makes it not so useful for drives you carry around to lots of different PCs, but it can be really helpful if you often work on the same computer.

不幸的是,您需要在要自动运行USB驱动器的每台Windows 7或更高版本的PC上安装APO USB Autorun。 这使得它对于随身携带到许多不同PC上的驱动器没有太大用处,但是如果您经常在同一台计算机上工作,那么它确实很有用。

第二步:设置USB驱动器 (Step Two: Set Up the USB Drive)

In order to autorun a program, the USB drive needs to contain two things: the program you want to run and an autorun script file that points to that program.

为了自动运行程序,USB驱动器需要包含两件东西:要运行的程序和指向该程序的自动运行脚本文件。

Go ahead and copy the portable executable for the program to your USB drive. That’s the easy part.

继续并将该程序的可移植可执行文件复制到USB驱动器。 那是容易的部分。

To create the autorun script file, open up Notepad (or whatever text editor you prefer). Type (or copy and paste) the following text into the Notepad window, complete with line breaks.

要创建自动运行脚本文件,请打开记事本(或您喜欢的任何文本编辑器)。 在记事本窗口中键入(或复制并粘贴)以下文本,并带有换行符。

[autorun]
 ;Open=YOURAPP.exe
 ShellExecute=YOURAPP.exe
 UseAutoPlay=1

Replace the “YOURAPP” text with the file name of the application you’re trying to start. I’m using the portable version of the Lynx browser for this demonstration, so my commands read like this:

将“ YOURAPP”文本替换为您要启动的应用程序的文件名。 我在此演示中使用的是Lynx浏览器的便携式版本,因此我的命令如下所示:

[autorun]
 ;Open=LynxPortable.exe
 ShellExecute=LynxPortable.exe
 UseAutoPlay=1

Next, save the file to your USB drive with the name “autorun.inf” and make sure that you select “All Files (*.*)” in the “Save as type” field. That way, Notepad won’t add an additional “.txt” extension to the end of your file name.

接下来,使用名称“ autorun.inf”将文件保存到USB驱动器,并确保在“另存为类型”字段中选择“所有文件(*。*)”。 这样,记事本就不会在文件名的末尾添加额外的“ .txt”扩展名。

The root folder of your USB drive should now contain the program’s executable file and the autorun.inf file you just created.

现在,USB驱动器的根文件夹应包含程序的可执行文件和刚创建的autorun.inf文件。

You can place other files and folders in the drive, of course, but make sure to keep those two items in the root directory.

当然,您可以在驱动器中放置其他文件和文件夹,但请确保将这两项保留在根目录中。

Now, with APO USB Autorun running and your USB drive properly configured, your program should run automatically whenever you connect the USB drive to your PC.

现在,在运行APO USB Autorun并正确配置USB驱动器的情况下,只要将USB驱动器连接到PC,程序就应该自动运行。

Image credit: Amazon

图片来源: 亚马逊

翻译自: https://www.howtogeek.com/326049/how-to-auto-run-windows-programs-when-you-plug-in-a-usb-drive/

usb插入后自动启动程序

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值