You are here

[Feature Suggestion] Autoexec for USB drive

1 post / 0 new
mubed
Offline
Last seen: 14 years 2 days ago
Joined: 2009-01-26 23:52
[Feature Suggestion] Autoexec for USB drive

After installing PNotes I realized the need for a launcher that runs besides PAM also other applications each time I insert the USB drive. The proposed method for this is to use a batch file on the drive which is launched by Autorun.inf. In this file you type the commands you want to be run after or before PAM is launched and of course you must think of running PAM itself. This worked fine just by replacing following line in autorun.inf:

Open=PortableApps.exe

with:

Open=Autoexec.bat

and the file Autoexec.bat looks like this:

autoexec.bat
============
@echo off
StartPortableApps.exe
\PNotesPortable\PNotesPortable.exe
============

It has though a little esthetical drawback: a command window is appeared during the time autoexec.bat is being run. This can be avoided using a VB shell script or a command line launcher like NirCMD that runs the batch file in hidden mode. Different methods are provided here:

http://www.winhelponline.com/blog/run-bat-files-invisibly-without-displa...
http://forum.sysinternals.com/forum_posts.asp?TID=10507
http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Ba...

I used NirCMD and changed the line mentioned above to this:

Open=PortableApps\NIRCMD.EXE EXEC hide PortableApps\Autoexec.bat

both NirCMD.exe and Autoexec.bat are placed in PortableApps folder.

My Suggestion is to integrate one of these methods in PAM to launch a specific batch file (like autoexec.bat) whenever PAM starts. This file is better placed in PrtableApps folder rather than in root.