Make a file automatically run when flash drive plugged to computer - usb

Is there any way to make a file automatically run when USB or hard drive is plugged to a computer?
I have tried with the autorun.inf file, but the function has been removed in win 7 and 8.

Microsoft has disabled this feature by default on 'non-optical drives' from Windows 7 and onward in order to reduce chances of malware being run. This was replaced with the 'AutoPlay' prompt, which asks the user what they would like to do before executing any applications.
A common malware attack against businesses is to leave a USB drive where an unsuspecting employee will find it. Usually curiosity gets the better of the employee and they insert the newly-found USB drive into their company computer to "see whats on it". If the computer allows any program to run when the drive is mounted (as autorun.inf used to allow) then a virus can execute immediately without any further user input.
Here's some more in-depth reading on the subject - http://blogs.technet.com/b/srd/archive/2009/04/28/autorun-changes-in-windows-7.aspx

Related

How to set up a PDF network printer that will keep the PDF file

I would like to find a way to have a Windows computer share a virtual PDF printer with other local computers (that first part is easy!). However, I would like the PDF to be saved on the print server and not on the computer from which the print out is initiated. Any idea how to do that?
This is going to depend on your skill at resolving other driver problems.
I was able after several false starts to get a 32bit Win 7 peer user (admin) to print on My Win 10 restricted user Virtual printer. But the output result is not great so would need to dig deeper, than I need, just to find out why.
I used a GhostScript Virtual Printer since It allows remote users on network to download its drivers for ARM x64 and x32
It is hosted on a 64bit Win 10 restricted account so I had to jump through hoops to get it seen and accessible on the network, and then had to dig into it share settings to see 32bit/Arm clients need an extra check box on.
It took some challenges to get the 32bit client to see printer was available but it ran from there with the above test page output in the 64bit printme folder, Whilst monitoring that file visually real-time a print from the client was transmitted and instantly appeared on the host screen without noticeable corruption unlike the test print!!.
So an issue you could have is how to stop clients from overwriting the file whilst they are post processed (renamed like in a port redirection monitor) since my GS virtual printer uses a single named NoPromptPort.pdf
Your question should in effect be answered, However My Question is why go this route? It would be so much simpler efficient and reliable for each client to MSPrint to NoPromptPort.PDF then simply copy their renamed.PDF to a server folder.

kiosk - content updating

I have a kiosk computer that runs IE 9.0 "http://localhost" to display content on the D:\ drive.
I want to be able to write a program that when a USB flash drive is inserted, it will copy the files from the flash drive and then reload the localhost page. The computer runs XAMPP (Apache and PHP). How can I accomplish this?
I was thinking of using Windows Task Scheduler and run it every 5 minutes, but sometimes it can take longer than 5 minutes to copy files. And if I set it to 15min to be safe, then the person updating the kiosk has to wait approx 15 minutes for the task to run again, plus the time to copy.
Any help, ideas, or direction on how to proceed would be GREAT!
Could you write a Windows service that periodically (once every 10-20 seconds?) checks for files on the drive letter that the thumb drive uses? If files are found, copy them to the proper locations.
Does the computer have internet access? Normally these things would just be pushed out to the computer remotely.

Is it possible to save per application settings without admin rights (cross platform)

I want to write an application that saves some shared settings on the local computer. But the problem is that anyone, including guests, should be able to use it.
So if a guest runs this application, it should be able to write data to persistent storage where everyone has r/w permissions.
The application can be launched from read-only media. So executable local files are off limits.
Do modern OSes support such scenario? Windows is supposed to have "All Users\Application Data", but it seems to be a junction point of some sort on W7, with weird permissions.
No idea about Linux and Mac at all.

Making an application launcher

Okay so I want to make an application that launches other applications. However, the goal here is to make the app "portable" in that I can go from one windows desktop to another while using the same application from a usb drive. So here is a different rundown of what I mean:
I have aplication X. I use it on machine 1 and I want to use it on machine 2. However, machine 2 is my buddy's and he does not want me installing things on it. So, I take all the files that the installer made on my system, and put them into folders. App X put files in the windows folder that it expects when it is launched. If I merely run the the app and it looks in the windows dir it will not find the files. I do not have/want the ability to put files in the windows dir. I want to tell the app to look in folder a for files in folder b instead of where it would normally look. I could then use this program on any machine without having to modify the machine in any way.
Is this doable? If so what is it called so I can look it up?
EDIT: the win dir was an example. I would like the app to be self contained in a folder on the thumb drive. I want to redirect the where the app looks for files to a folder I specify.
This can be done, but how easily depends entirely on the program that you are launching.
The sorts of things that applications will do are:
Just run happily being executed anywhere (no dependencies). These are very easy!
Require some environment variables to be set up. This is easy to do - you can launch a new process with a modified environment if you wish.
Read files from disk. Usually when loading things like .dlls, applications will search on the PATH for the dlls, so they can be copied into the application folder (next to the .exe) and it will run happily on any system. However, in some cases applications will use fixed (or at least, less flexible) paths so that they will be harder to launch successfully.
Read registry settings. This is trickier. You need to know what state is required by the application, have your launcher record the old registry state, change it and run the application, then wait for application exit to restore the original state. This has to be bullet-proof to avoid corruption of the user's registry.
Ultimately you'll need to investigate, for each app you want to launch, just what it needs to run.
If the apps are commercial, then be careful that you are not breaking any licensing (EULA) terms by running them in this way.
Another alternative would be to set up a virtual PC image and simply execute that on the host PC so there is no need to worry about any special cases for each application. Depending on the VPC software you have available you may need to install software on the host PC to allow a virtual PC session to be run though, which may defeat the purpose/intent.
I think the system you describe is U3 (more info at http://en.wikipedia.org/wiki/U3). It requires the application to follow the U3 protocol, but if the application does, then it can be run off of a U3 flash drive without any install or admin permissions required on the host machine.
It's a proprietary technology, and supported by only a few vendors that I've seen.
If you really want portability and power, consider VMWare Player, and carry and entire machine, customized to your needs, on the flash drive. Of course, your friend would probably have to allow you to install VMWare Player.

Automatically launch app on USB (through autorun?)

Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista.
I looked into "autorun.inf" and "open" entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is it possible to launch program automatically on all windows versions?
I don't care if autorun is disabled by user in Windows settings.
First of all, some people choose to disable autorun for security reasons; but Windows computers up to Vista have it enabled. Edit: Apparently the functionality was removed from Windows 7 onwards.
Put a file named autorun.inf in the root of your USB flash drive. This is what's in mine:
[Autorun]
Open=PStart.exe
Action=Start portable apps
Icon=diskicon.ico
What it does: when you insert this disk, starts PStart.exe
On older computers, the program specified in Open= will launch automatically.
On most modern computers (Windows XP SP2+, Vista), dialog "what do you want to do" will be displayed (for security reasons), but what you have in autorun.inf will display as the selected default, with Icon= as icon and Action= as description. If you want to launch it, just click the "OK" button in the dialog.
So, although I'm not aware of any way to start the application (e.g. PStart) immediately, it is possible to insert flash disk with this configuration and start application by clicking OK.
Tested on different computers, running Windows XP without a SP, also on Windows XP sp 1, sp2, sp3, and on various Vistas (not sure which types, but should work all the way from Vista Home Basic to Vista Enterprise Super-Mega-Premium-Extended Edition) and "Windows 7". Also works on Windows 2000 (although autorun on Win2000 for removable drives is not enabled in default configuration).
Note that some applications, in addition, may trigger the "unknown/unsigned exacutable" security dialog, as if you opened them manually.
Edit: For more details, see also:
Autoplay in Windows XP: Automatically Detect and React to New Devices on a System
I've had something set up on my USB keys for a while now. Using the autorun.inf file will work, depending on your system's settings for autorun. Some disable it altogether after that little debacle with Sony a couple years back installing rootkit software on peoples' machines. Here're a couple articles to check out.
Label a Flash Drive with Your Name and Number
Have Your Lost USB Drive Ask For Help (1) or 2
you need UseAutoplay to let this work on usb.
and if you take ShellExecute instead of open you can also open scripts/documents/...
[Autorun]
ShellExecute=System\something.exe
UseAutoplay=1
there are also U3 usb sticks arround, they will be reconised as cdrom drives in windows.
if you put an a autorun.inf on one of those, it will get executed without the user being questioned.
regards morla
I found the solution in this blog
How To Auto-Launch Apps With A USB Stick [Windows]
It worked fine for me
(the article explains how to do it with AutoIT, a 3rd party app that must be installed on the host computer)