Windows 7 doesn't autorun Portable Apps Starter on Flash drive

6

3

I'm afraid the answer is "it won't due to new security features", but I'll ask anyway.

I have a USB Flash Drive I run Portable Applications on (who doesn't, right?). I use PStart to start up a nice menu I've been using for a couple years, have my configuration dialed in to something that is productive, so I'm not inclined to just switch to another program.

I have an Autorun.inf in the root of the drive. Its contents:

[Autorun]
Open=Applications\pstart\PStart.exe
Action=Start PortableApps
Icon=Applications\PortableAppsMenu\PortableAppsMenu.exe
Label=PortableApps

When I insert the device on Windows 7, I get prompted to choose from a variety of autostart things I don't want to do:

autorun dialog

It worked fine on XP and Vista, on inserting the PStart.exe would start up and I have menu.

jtimberman

Posted 2009-07-18T16:02:00.163

Reputation: 20 109

Answers

11

Unfortunately, you're correct.

The new security features of Windows 7 will not run autorun programs unless it's on optical media.

See more here: AutoRun changes in Windows 7.

Lasse V. Karlsen

Posted 2009-07-18T16:02:00.163

Reputation: 3 196

4Heh. I am of the opposite opinion; autorun is the most evil thing ever invented. I suppose having it do nothing by default would have been a better alternative to removing it completely. – RJFalconer – 2010-02-04T22:03:05.323

"...so our customers can benefit..." - People who take security seriously and don't put arbitrary devices in their computers suffer from the inconvenience. I'd like the option to allow specific devices to autorun, even if I have to set it manually the first time :(. – jtimberman – 2009-07-18T16:21:54.133

0

This is something I was considering for a previous project and I didn't end up starting it it however my approach would have been to edit the following PowerShell script to run whatever application I wanted, in my case it would be to eject all but specific USB drives. Basically the script monitors the Win32_VolumeChangeEvent table for additions then triggers an application along with some of the event metadata such as drive letter. It could be adapted to run any application or script.

function UsbMountWatcher {
     $alarm = New-Object System.Management.EventQuery
     $alarm.QueryString = "SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2"
     New-Object System.Management.ManagementEventWatcher $alarm
}
$pathtompcmdrun = $env:PROGRAMFILES + "\Windows Defender\MpCmdRun.exe"
$watcher = UsbMountWatcher
while ($true) {
     $event = $watcher.WaitForNextEvent()
     $driveletter = $event.Properties["DriveName"].Value.ToString() + "\"
     &$pathtompcmdrun "-Scan" "-File" $driveletter "-DisableRemediation"
     Write-Output $LASTEXITCODE
}
$watcher.Stop()

Source: https://gallery.technet.microsoft.com/Custom-scan-a-USB-drive-17b9be2a

Further reading: https://alitarhini.wordpress.com/2010/11/05/listen-for-removable-device-events/

This should also address the merged but different Windows 10 question: how to automatically run a batch file when USB drive inserted in Windows 10?

Andy Gee

Posted 2009-07-18T16:02:00.163

Reputation: 133