Jump to content

How can I get the name of the .vbs script that is running


RRRSystems

Recommended Posts

Hello,

 

I would like to get the name of the .vbs script that is running.

I will store that name and some other info as properties once I can get it,

I know how to make those changes.

 

In my example I have where I would like to get the name and other info,

I am just using a msgbox for now to try and find it.

 

Thanks,

 

Raney

 

'///////////////////////////////////////////////////////////////////////////////

'/ Class.Script.vbs

'///////////////////////////////////////////////////////////////////////////////

Option Explicit

'///////////////////////////////////////////////////////////////////////////////

'/ 01-0000 2013/09/04; Initial Release; VBScript Version 5.8 Compliant. '///////////////////////////////////////////////////////////////////////////////

Class Script_Object

'------------------

Private MyTitle, _ '<<<<< I will add the property here and create the Get and Let

MyCopyright, _ ' to go with it

MyVersion

 

Private Sub Class_Initialize()

MyTitle = "Script_Object"

MyCopyright = "2013"

MyVersion = "01-0000"

End Sub

 

Private Sub Class_Terminate()

End Sub

 

Public Property Get Title

Title = MyTitle

End Property

 

Public Property Get Copyright

Copyright = MyCopyright

End Property

 

Public Property Get Version

Version = MyVersion

End Property

 

Property Let Title(StrTitle)

MyTitle = StrTitle

End Property

 

Property Let Copyright(StrYear)

MyCopyright = StrYear

End Property

 

Property Let Version(StrVersion)

MyVersion = StrVersion

End Property

 

End Class

'///////////////////////////////////////////////////////////////////////////////

Public Script

'///////////////////////////////////////////////////////////////////////////////

Private Sub Initialize()

'-----------------------

Set Script = New Script_Object

msgbox whatever ' <<<< this is where I would like to get the .vbs name and store as a property

End Sub

'///////////////////////////////////////////////////////////////////////////////

Initialize

'///////////////////////////////////////////////////////////////////////////////

Link to comment
Share on other sites

I have tried that it gives me the name of the .wsf that includes the .vbs files

 

<job id = "X-Testing.wsf"><script language = "VBScript" Src = ".Include/Class.Script.vbs"/><script language = "VBScript" Src = ".Include/Constants.vbs"/><script language = "VBScript" Src = ".Include/Utility.vbs"/><script language = "VBScript" Src = "Development/X-Testing.vbs"/></job>

 

When I use WScript.ScriptName or WScript.ScriptFullName in the .vbs Script I get the name of this file.

 

Thanks,

Raney

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...