Sumesh BNR
asked on
get the current working directory in vb script
Hi All,
I have an application that is a portable utility which doesn't require installation and I used to copy the folder to any where in windows 7 and windows xp and can execute fine .I want to create a shortcut through a script regardless of where my installation files are located and the script need to automatically select the current directory and make a short cut in windows xp and 7 desktops.I have tried using the batch file but it is copy the setup.exe to desktop and I don't want this because there is config file in this application can any one suggest a way to do this. Also I have tried using the following script . bu T I don't know how to get the current working directory as the oShellLink.TargetPath and oShellLink.WorkingDirector y .Please help
set WshShell = WScript.CreateObject("WScr ipt.Shell" )
strDesktop = WshShell.SpecialFolders("A llUsersDes ktop" )
set oShellLink = WshShell.CreateShortcut(st rDesktop & "\Shortcut to MissARSSE_PM.exe.lnk" )
oShellLink.TargetPath = "c:\myapp\setup.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "c:\myapp\Source\icon2.ico "
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirector y = "c:\myapp\setup.exe"
oShellLink.Save
Thanks
I have an application that is a portable utility which doesn't require installation and I used to copy the folder to any where in windows 7 and windows xp and can execute fine .I want to create a shortcut through a script regardless of where my installation files are located and the script need to automatically select the current directory and make a short cut in windows xp and 7 desktops.I have tried using the batch file but it is copy the setup.exe to desktop and I don't want this because there is config file in this application can any one suggest a way to do this. Also I have tried using the following script . bu T I don't know how to get the current working directory as the oShellLink.TargetPath and oShellLink.WorkingDirector
set WshShell = WScript.CreateObject("WScr
strDesktop = WshShell.SpecialFolders("A
set oShellLink = WshShell.CreateShortcut(st
oShellLink.TargetPath = "c:\myapp\setup.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "c:\myapp\Source\icon2.ico
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirector
oShellLink.Save
Thanks
ASKER
I didn't get you .Can you modify the script to get the current working directory as the directory where the script is located .I call my script with myscript.vbs.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.computerperformance.co.uk/ezine/ezine119.htm
replace the working folder with this:
http://leereid.wordpress.com/2008/03/19/vbscript-current-directory-or-folder/
Set oShell = CreateObject(”WScript.Shel
Set ofso = CreateObject(”Scripting.Fi
oShell.CurrentDirectory = oFSO.GetParentFolderName(W