Here are the scripts which do that:
createShortcut.pl
use strict; use Cwd; mkdir "PortableAppsShortcuts"; my $currDir = getcwd(); my @files = <PortableApps\\*\\*.exe>; my $file; foreach $file (@files) { my $program = "none"; if( $file =~ m/([a-zA-Z0-9_\- ]+)Portable\.exe/ ) { $program = $1; } elsif ( $file =~ m/([a-zA-Z0-9_\- ]+)\.exe/ ) { $program = $1; } my $link = "$currDir\\PortableAppsShortcuts\\$program.lnk"; my $source = "$currDir\\$file"; &createLink( $link, $source ); print "Shortcut Created: $program\n"; } exit 0; #============================================================================== # Creates a shortcut for a file #------------------------------------------------------------------------------ use Win32::OLE; sub createLink { my ($link, $source) = @_; my $shell = Win32::OLE->CreateObject("WScript.Shell"); my $oShellLink = $shell->CreateShortcut("$link" ); $oShellLink->{TargetPath} = "$source" ; $oShellLink->{WindowStyle} = 1; $oShellLink->Save; } |
copyShortcuts.cmd
xcopy /E /I /F PortableAppsShortcuts "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\PortableAppsShortcuts" xcopy /E /I /F PortableAppsShortcuts "%USERPROFILE%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\PortableAppsShortcuts" |
setEnv.cmd
PATH=%PATH%;%CD%\PortableApps\XAMPP\App\xampp\perl\bin\;%CD%\PortableApps\gVimPortable\App\vim\vim72 |
No comments:
Post a Comment