1 out of 1 rated this helpful - Rate this topic

ScriptName Property

Returns the file name of the currently running script.


                      object.ScriptName
object

WScript object.

The ScriptName property is a read-only string.

The following VBScript code echoes the name of the script being run.

WScript.Echo WScript.ScriptName
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
But what does it look like?
What this page fails to tell you is the result of using ScriptName.

If your script file name is "myscript.wsf", WScript.ScriptName will return "myscript.wsf".

Compare that to WScript.Name which will return "Windows Script Host". (assuming you launched your script via cscript or wscript)