Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Get the current path of the vbs file

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,33743
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get the current path of the vbs file
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Get the current path of the vbs file - 4/21/2006 1:31:28 AM   
  VBoy

 

Posts: 11
Score: 0
Joined: 4/19/2006
Status: offline
Hi!

Can anybody tell me, how I can get in the script, the path of the vbs file, what I'm running?

Thanks
 
 
Post #: 1
 
 RE: Get the current path of the vbs file - 4/21/2006 1:36:28 AM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi VBoy,

straight from the VBScript docs:

ScriptFullName Property
Returns the full path of the currently running script.

object.ScriptFullName
  Arguments
    object  WScript object.
  Remarks
    The ScriptFullName property is a read-only string.

(in reply to VBoy)
 
 
Post #: 2
 
 RE: Get the current path of the vbs file - 4/21/2006 1:37:37 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
WScript.Echo Replace(WScript.ScriptFullName, WScript.ScriptName, "")

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to VBoy)
 
 
Post #: 3
 
 RE: Get the current path of the vbs file - 4/21/2006 1:46:19 AM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi ebgreen,

now I was faster, but your code  is better:

  (1) doing exactly what VBoy asked for

  (2) getting the path with terminating "\" and no need to use a FileSystemObject for splitting

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: Get the current path of the vbs file - 4/24/2006 5:58:45 PM   
  VBoy

 

Posts: 11
Score: 0
Joined: 4/19/2006
Status: offline
Hi ebgreen, ehvbs!
Thanks a lot! It was pretty simple, just not for me

(in reply to ehvbs)
 
 
Post #: 5
 
 RE: Get the current path of the vbs file - 4/24/2006 11:02:03 PM   
  mbouchard


Posts: 1861
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
Personally, I am a fan of GetParentFolderName

Set fso = CreateObject("Scripting.FileSystemObject")
  wscript.Echo fso.GetParentFolderName(wscript.ScriptFullName)

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to VBoy)
 
 
Post #: 6
 
 RE: Get the current path of the vbs file - 4/25/2006 12:44:25 PM   
  DiGiTAL.SkReAM


Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: online
I also prefer the fso.GetParentFolderName method.

And that has nothing to do with the fact that mbouchard is an Administrator.

Really.

Honest.


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to mbouchard)
 
 
Post #: 7
 
 RE: Get the current path of the vbs file - 4/25/2006 11:32:42 PM   
  mbouchard


Posts: 1861
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
quote:

ORIGINAL: DiGiTAL.SkReAM

I also prefer the fso.GetParentFolderName method.

And that has nothing to do with the fact that mbouchard is an Administrator.

Really.

Honest.


Flattery will get you nowhere, cash helps though.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 8
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get the current path of the vbs file Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts