Pagine

Scripting - How to change working directory .vbs

When you write .vbs scripts and you need to change working directory you need to use below commands.

Option Explicit
Dim objWShell
Dim strCDCache

Set objWShell = WScript.CreateObject("WScript.Shell")
strCDCache = objWShell.CurrentDirectory

objWShell.CurrentDirectory = "insertnewpath"
wscript.echo wshshell.currentdirectory

'Restore CurDir if need be.
objWShell.CurrentDirectory = strCDCache
wscript.echo wshshell.currentdirectory

[original article here]