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();
}
This also works great in command line EXE files created by bamcompile