package HowToCreateShortCutsInWindows;
#This package demonstrates how to create shortcuts with Perl in Windows (Tested on XP )
use File::Copy ;
use strict ;
use warnings ;
use File::Find ;
use File::Path ;
use Win32 ;
use Win32::Process ;
use Win32::OLE;
#perl2exe_include "attributes.pm";
our $userName = $ENV{USERNAME} ;
print "userName is $userName \n " ;
createShortTosome_exe();
sub createShortTosome_exe
{
$Win32::OLE::Warn = 3;
my $objWSHShell = Win32::OLE->new('WScript.Shell');
# Pass the path to the shortcut
my $objSC = $objWSHShell->CreateShortcut("C:\\Documents and Settings\\$userName\\Start Menu\\Programs\\Startup\\Shortcut_To_some_exe.lnk");
# Description - Description of the shortcut
$objSC->{Description} = 'Shortcut to my exe ';
# IconLocation – Path of icon to use for the shortcut file
$objSC->{IconLocation} = 'explorer.exe, 0';
# 0 is the index
# TargetPath = Path to source file or folder
$objSC->{TargetPath} = 'C:\\Temp\\some_folder\\some_exe.exe';
# Arguments – Any additional parameters to pass to TargetPath
$objSC->{Arguments} = 'C:\\Temp\\some_folder\\';
# WindowStyle – Type of window to create
$objSC->{WindowStyle} = 3;
# 1 = normal; 3 = maximize window; 7 = minimize
# WorkingDirectory – Location of the working directory for the source app
$objSC->{WorkingDirectory} = 'C:\\Temp\\some_folder';
$objSC->Save();
}
1 ;
__END__
What the heck is a `\\.\nul` path and why is it breaking my Directory Files
Lookup?
-
[image: Null Device Banner]
In the last few months my Markdown Monster Application Insights log has
been inundated with a hard failure for lookups of a \...
1 month ago
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!