JSI Tip 10232. How can I change the current directory in a VBScript to be the folder that the script is started from?


To change the current directory in a VBScript
to be the folder that the script is started from:

set oShell = createobject("wscript.shell")
oShell.currentdirectory = wscript.scriptfullname & "\.."

To prove that this works, try:

set oShell = createobject("wscript.shell")
wscript.echo oShell.currentdirectory
oShell.currentdirectory = wscript.scriptfullname & "\.."
wscript.echo oShell.currentdirectory



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish