I want to open a file when i insert USB drive on system without open auto-run dialog windows. when i insert USB drive file automatically execute without knowing and silently it will not display auto-run dialog box to open a file how to do this?
This is not something supported by Windows, for obvious security reasons.
You're free to change Group Policy settings on the machine, provided you have local (or domain) Administrative access - otherwise you can't, and you shouldn't.
I'm having a little trouble figuring out how to use a root directory with a program for flash drives. For example: I'm trying to run "E://Program/data/install.vbs" but the driver letter keeps changing. Any help will be appreciated, thank you.
I think the batch version of what I am looking for is %root%\Program\data\install.bat but I still need it in vbscript form.
Try to "lock" the letter of flash drive in Computer Management is you are using Windows.
If you use Windows then go to Control Panel > Disk Management
Find your drive, right click, select "change drive latter and path", click on "add" browse to a new folder on your local computer [C:\MyFlashCard].
Every time you connect your flash drive, no matter which drive latter it gets, it will be mounted to the folder you selected, so you can use the local path. [c:\MyFlashDrive\program\data\install.vbs]
I am trying to open a .chm file.
I downloaded the source, extracted it, and double clicked on Waffle.chm and clicked "Open" but no matter what element in the chm file I click, I get the message:
Navigation to the webpage was canceled.
What you can try:
Retype the address.
What's going on here?
Summary
Microsoft Security Updates 896358 & 840315 block display of CHM file contents when opened from a network drive (or a UNC path). This is Windows' attempt to stop attack vectors for viruses/malware from infecting your computer and has blocked out the .chm file that draw data over the "InfoTech" protocol, which this chm file uses.
Microsoft's summary of the problem: http://support.microsoft.com/kb/896054
Solutions
If you are using Windows Server 2008, Windows 7, windows has created a quick fix. Right click the chm file, and you will get the "yourfile.chm Properties" dialog box, at the bottom, a button called "Unblock" appears. Click Unblock and press OK, and try to open the chm file again, it works correctly. This option is not available for earlier versions of Windows before WindowsXP (SP3).
Solve the problem by moving your chm file OFF the network drive. You may be unaware you are using a network drive, double check now: Right click your .chm file, click properties and look at the "location" field. If it starts with two backslashes like this: \\epicserver\blah\, then you are using a networked drive. So to fix it, Copy the chm file, and paste it into a local drive, like C:\ or E:. Then try to reopen the chm file, windows does not freak out.
Last resort, if you can't copy/move the file off the networked drive. If you must open it where it sits, and you are using a lesser version of windows like XP, Vista, ME or other, you will have to manually tell Windows not to freak out over this .chm file. HHReg (HTML Help Registration Utility) Utility Automates this Task. Basically you download the HHReg utility, load your .chm file, press OK, and it will create the necessary registry keys to tell Windows not to block it. For more info: http://www.winhelponline.com/blog/fix-cannot-view-chm-files-network-xp-2003-vista/
Windows 8 or 10? --> Upgrade to Windows XP.
"unblocking" the file fixes the problem. Screenshot:
Win 8 x64:
just move it to another folder or rename your folder (in my case: my folder was "c#").
avoid to use symbol on folder name. name it with letter.
done.
In addition to Eric Leschinski's answer, and because this is stackoverflow, a programmatical solution:
Windows uses hidden file forks to mark content as "downloaded". Truncating these unblocks the file. The name of the stream used for CHM's is "Zone.Identifier". One can access streams by appending :streamname when opening the file. (keep backups the first time, in case your RTL messes that up!)
In Delphi it would look like this:
var f : file;
begin
writeln('unblocking ',s);
assignfile(f,'some.chm:Zone.Identifier');
rewrite(f,1);
truncate(f);
closefile(f);
end;
I'm told that on non forked filesystems (like FAT32) there are hidden files, but I haven't gotten to the bottom of that yet.
P.s. Delphi's DeleteFile() should also recognize forks.
The definitive solution is to allow the InfoTech protocol to work in the intranet zone.
Add the following value to the registry and the problem should be solved:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000001
More info here: http://support.microsoft.com/kb/896054
Go to Start
Type regsvr32 hhctrl.ocx
You should get a success message like:
" DllRegisterServer in hhctrl.ocx succeeded "
Now try to open your CHM file again.
other way is to use different third party software. This link shows more third party software to view chm files...
I tried with SumatraPDF and it work fine.
I fixed this programmatically in my software, using C++ Builder.
Before I assign the CHM help file, Application->HelpFile = HelpFileName, I check to see if it contains the "Zone.Identifier" stream, and when it does, I simply remove it.
String ZIStream(HelpFileName + ":Zone.Identifier") ;
if (FileExists(ZIStream))
{ DeleteFile(ZIStream) ; }
There are apparently different levels of authentication. Most articles I read tell you to set the MaxAllowedZone to '1' which means that local machine zone and intranet zone are allowed but '4' allows access for 'all' zones.
For more info, read this article:
https://support.microsoft.com/en-us/kb/892675
This is how my registry looks (I wasn't sure it would work with the wild cards but it seems to work for me):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"UrlAllowList"="\\\\<network_path_root>;\\\\<network_path_root>\*;\\ies-inc.local;http://www.*;http://*;https://www.*;https://*;"
As an additional note, weirdly the "UrlAllowList" key was required to make this work on another PC but not my test one. It's probably not required at all but when I added it, it fixed the problem. The user may have not closed the original file or something like that. So just a consideration. I suggest try the least and test it, then add if needed. Once you confirm, you can deploy if needed. Good Luck!
Edit: P.S. Another method that worked was mapping the path to the network locally by using mklink /d (symbolic linking in Windows 7 or newer) but mapping a network drive letter (Z: for testing) did not work. Just food for thought and I did not have to 'Unblock' any files. Also the accepted 'Solution' did not resolve the issue for me.
Moving to local folder is the quickest solution, nothing else worked for me esp because I was not admin on my system (can't edit registery etc), which is a typical case in a work environment.
Create a folder in C:\help drive, lets call it help and copy the files there and open.
Do not copy to mydocuments or anywhere else, those locations are usually on network drive in office setup and will not work.
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.
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
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!
I want my software to run automatically from a CD/DVD with no user interaction whenever the user puts the CD/DVD into the drive. As far as I know autorun should still work with Windows 7, they just forbid it for USB drives.
But how?
Let's say I want to start my software xy.exe, what do I have to put inside my autorun.inf? I tried this but it's not working:
[AutoRun]
open=xy.exe
Is there anything else to do? Any suggestions?
See MS' official Autorun documentation at
http://msdn.microsoft.com/en-us/library/cc144202(v=vs.85).aspx
Your autorun.inf example looks OK to me - if you are testing on Windows 7 then I would expect you to see the "AutoPlay" Window when you insert the CD, with xy.exe as an option, above "open folder to view files".
If you get no pop up at all then try right-clicking on the disc in My Computer and selecting AutoPlay in the context menu.
You may need to pass an argument to the program to be auto played:
[autorun]
open=myprogram.exe /argument