JSI Tip 10486. How can a Vbscript determine the drive/folder path of the script?

Jerold Schulman

May 14, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today


In a batch script, you can determine the the folder path of your script by using the %~DP0 parameter.

To determine the folder path of a Vbscript, use:

sn = Wscript.ScriptName '        Script Name        fn = Wscript.ScriptFullName '    Fully Qualified Script Namefp = Replace(fn, "" & sn, "") ' Drive / Folder pathWscript.Echo fp



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like