However, I've modified the code slightly so you can set a 'working folder'
so you simply call the function like this:
symlink (notepad.exe,newshortcut.lnk,d:\) where the shortcut will be called newshortcut, and the target being notepad.exe and the working directory being D:\
function symlink($target, $link, $workingdir) {
$shell = new COM('WScript.Shell');
$shortcut = $shell->createshortcut($link);
$shortcut->targetpath = $target;
$shortcut->WorkingDirectory = $workingdir;
$shortcut->save();
}
so you simply call the function like this:
symlink (notepad.exe,newshortcut.lnk,d:\) where the shortcut will be called newshortcut, and the target being notepad.exe and the working directory being D:\
function symlink($target, $link, $workingdir) {
$shell = new COM('WScript.Shell');
$shortcut = $shell->createshortcut($link);
$shortcut->targetpath = $target;
$shortcut->WorkingDirectory = $workingdir;
$shortcut->save();
}
0 comments:
Post a Comment