Post by Joe EarnestSeems to work fine, or at least like it's supposed to.
WshShell.CurrentDirectory produces *exactly* the same result.... I
Most of the time it will, but there are circumstances where the current
directory *can* be different from the script's parent folder depending on
how the script was actually launched. It all depends on exactly what you
want.
For example...
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.CurrentDirectory
WshShell.CurrentDirectory = wscript.scriptfullname & "\.."
WScript.Echo WshShell.CurrentDirectory
If you launch the script by double-clicking it from Windows Explorer, then
both echo's show the same value.
If you launch the script via the Start Menu / Run dialog with:
wscript d:\scripts\myscript.vbs
or
cscript d:\scripts\myscript.vbs
then both echo's probably won't show the same value.
If you launch the script from a console window opened on a different folder
from the script's parent folder with:
start d:\scripts\myscript.vbs
or just (on NT/2K/XP)
d:\scripts\myscript.vbs
or via a shortcut (lnk) file with an explicit 'Start in:' path different
from the script's parent folder, then both echo's will *not* show the same
value.
--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US