Jump to content
Sign in to follow this  
RRRSystems

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

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

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

That's the only thing I found from searching. You can probably find a reference for the WScript object that would list the available properties and methods.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...