-
October 25th, 2005, 03:34 PM
#1
VBScript to get Windows Directory?
How do I get the window's directory using VBScript? Here's how I get the Program Files Directory:
Code:
Function GetProgramsFolder()
Dim wshShell
Set wshShell = WScript.CreateObject("WScript.Shell")
GetProgramsFolder = wshShell.SpecialFolders("AllUsersPrograms")
End Function
-
October 25th, 2005, 04:15 PM
#2
Re: VBScript to get Windows Directory?
Try this:
Code:
set shell = WScript.CreateObject("WScript.Shell")
windowsdir = shell.ExpandEnvironmentStrings("%windir%")
MsgBox(windowsdir)
-
October 31st, 2005, 06:29 PM
#3
Re: VBScript to get Windows Directory?
How about the system windows directory?
for example: when you're in a machine with Terminal Services, I want the system windows directory rather than C:\Documents and Settings\Adminstrator\WINDIR
thanks!
Last edited by koden; October 31st, 2005 at 06:46 PM.
-
November 1st, 2005, 12:08 AM
#4
Re: VBScript to get Windows Directory?
%windir% is a constant. How did it load the profile WINDOWS folder?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 1st, 2005, 01:04 PM
#5
Re: VBScript to get Windows Directory?
anyone know how to get the SYSTEM windows directory? I need this in the case where there are multiple users in a terminal services enabled machine.
-
November 1st, 2005, 02:01 PM
#6
Re: VBScript to get Windows Directory?
Open a command prompt and type "set" and press enter. This will show you all the current environment variables. Find the one you need and use it accordingly.
-
November 2nd, 2005, 12:48 PM
#7
Re: VBScript to get Windows Directory?
Originally Posted by mmetzger
Open a command prompt and type "set" and press enter. This will show you all the current environment variables. Find the one you need and use it accordingly.
I need to program this dynamically, so that anyone running my vbscript will have their system's windows directory path available.
please help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|