VB Script - Can a running script derive it's own path 
Author Message
 VB Script - Can a running script derive it's own path

VB Script - Can a running script derive it's own path.

I have a script, that resides on a CD at install time, when it runs, I
need to get a path to another file on that CD, so I need the script to
be able to know the path.
I don't want to try & enumerate all the CD ROM drives on the system,
because this may not always be run from a CD ROM, the image could be
copied on a network drive.

I am sure this is probably easy to do, but darn'ed if I know how.

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Mon, 31 Jan 2005 01:18:03 GMT  
 VB Script - Can a running script derive it's own path

Quote:
> VB Script - Can a running script derive it's own path.

> I have a script, that resides on a CD at install time, when it runs, I
> need to get a path to another file on that CD, so I need the script to
> be able to know the path.
> I don't want to try & enumerate all the CD ROM drives on the system,
> because this may not always be run from a CD ROM, the image could be
> copied on a network drive.

> I am sure this is probably easy to do, but darn'ed if I know how.

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

If you're talking about scripts that run under Windows Scripting Host,
you could use 2 properties of the wscript object, scriptName and
scriptFullName.

path = replace(wscript.scriptfullname, wscript.scriptname, "")

See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/script56/html/wsproscriptfullname.asp



Mon, 31 Jan 2005 21:28:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to disable security alert so my own script can run

2. Get Script file path within script

3. Can't run some VB scripts

4. Simple script won't run on certain user's PC

5. Running a .vbs script from within a .vbs script

6. vbs Timer script to run other script

7. Script works, script don't work

8. 'Remote Scripting Error: Page invoked does not support remote scripting

9. 'Canned' data in VB program

10. Calling one VB Script from another VB Script

11. Passing control from VB to VB Script -- need to access SetFocus in script

12. SCript desn't run on Read

 

 
Powered by phpBB® Forum Software