问题
I've been trying to come up with a way to autorun a series of HTML pages that are hosted on a USB Flash Drive. These are all static pages, and are all linked to index.html in my flash drive's root.
I tried setting up an autorun.inf file like this:
[autorun]
open=index.html
I have also tried this:
[autorun]
shellexecute=index.html
And I have tried this:
[autorun]
open=wscript.exe autorun.vbs
where autorun.vbs looks like this:
Call WScript.CreateObject("WScript.Shell").Run("index.html", 1)
So far, I've had no luck in getting the application to even show up on the autorun dialog. I even had a more robust autorun.inf similar to this one:
[autorun]
shellexecute=index.html
label=Test Application
action=Start Test Application
shell\start=Start Application
shell\start\command=index.html
shell=start
I switched out various shellexecute/open commands in a number of different configurations. I then stumbled upon a page during my research that said "Windows 7 no longer supports autorun.inf from flash drives." but there was no other information about this that I could find.
Anyone have a solution? I only would like to insert the flash drive and have the webpage within opened without other user input. If I have to deal with an autoplay dialog that has a "Display page" button, that would also be fine.
Edit: I also tried this link: Windows Autorun for an HTML file but it did not work either.
回答1:
As stated in my comment, windows no longer allows this. Here is a previous Stack Overflow article:
Auto-Running a program from USB flash drive
and another one:
http://www.addictivetips.com/windows-tips/autorun-inf-does-not-work-in-windows-7-anymore/
To allow autoplay edit your settings here:
Control Panel->All Control Panel Items->AutoPlay
回答2:
This link at Microsoft might solve your problem. Their solution copied below in case of link rot:
I would suggest you to use any of the below mentioned method and check if you are able to use the AutoPlay feature for removable drives as USB.
- Click Start and in the Search box, type gpedit.msc and press Enter.
- Now browse to Computer Configuration\ Administrative Templates\ Windows Components\ Autoplay Policies\ Turn off Autoplay.
- Change the value of Turn off Autoplay to disabled.
You may refer to the below links for further assistance -
Change AutoPlay settings - http://windows.microsoft.com/en-US/windows7/Change-AutoPlay-settings
Troubleshoot AutoPlay problems - http://windows.microsoft.com/en-US/windows7/Troubleshoot-AutoPlay-problems
Good luck!
来源:https://stackoverflow.com/questions/10743322/how-to-use-autorun-in-windows-7-from-a-flash-drive-to-open-a-webpage