
Originally Posted by
papayrus
OK done got one last question. I want to make the target directory and the working directory be the current directory this is what I came up with and it seems to be working can you tell me if this code is alright?
Code:
option explicit
call CreateShortCut()
sub CreateShortCut()
dim objShell, strEnvironment, objLink
set objShell = CreateObject("WScript.Shell")
strEnvironment = objShell.ExpandEnvironmentStrings("%USERPROFILE%\Start Menu\Programs\Accessories")
set objLink = objShell.CreateShortcut(strEnvironment & "\downIt.lnk")
objLink.Description = "Shortcut to downIt"
objLink.TargetPath = objShell.CurrentDirectory & "\downIt.bat"
objLink.WindowStyle = 1
objLink.WorkingDirectory = objShell.CurrentDirectory
objLink.Hotkey = "CTRL+SHIFT+ALT+U"
objLink.Description = "This will update the scanner from the internet."
objLink.Save
end sub
Try this:
Code:
'Define the current path
CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
'If running from desktop in WinXP result will be:
'C:\Documents and Settings\username\Desktop\downIt.bat
TargetPath = CurrentDirectory & "\downIt.bat"
'If running from desktop in WinXP result will be:
'C:\Documents and Settings\username\Desktop
WorkingDirectory = CurrentDirectory