»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 01-15-2004, 11:45 AM   #1 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
equiv to %windir% in VBS ?

What is the equivilant to %windir% variable in VBS ?

The intent is to copy files into the appropriate Windows directory based on if running XP or 2k (and regardless to which drive letter Windows is installed on), if the files do not already exist.


Last edited by DVNT1; 01-15-2004 at 12:14 PM.
DVNT1 is offline   Reply With Quote
Old 01-15-2004, 12:13 PM   #2 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
Hmmm

In this VBS example..

flagfile1 = "%windir%\notepad"
If not objFSO.FileExists (flagfile1) then
msgbox ("no file")
End If

WshShell.Run flagfile1


The WshShell.Run flagfile1 it works as expected (c:\winnt\notepad.exe runs).

But in the If not objFSO.FileExists (flagfile1) command it does not work as expected.
DVNT1 is offline   Reply With Quote
Old 01-15-2004, 12:35 PM   #3 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
found a way to do this:

Quote:
dim filesys, windir

Set filesys = CreateObject("Scripting.FileSystemObject")
Set windir = filesys.GetSpecialFolder(0)

If not objFSO.FileExists ( windir & "\notepad.exe") then
objFSO.CopyFile "f:\notepad.exe" , windir & "\"
End if
DVNT1 is offline   Reply With Quote
Old 01-15-2004, 12:43 PM   #4 (permalink)
Registered User
 
Join Date: Oct 2001
Location: TOO close to Wash DC
Posts: 7,956
vass0922 is on a distinguished road
The general way to get the system variables is such

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
WScript.Echo WshSysEnv("WINDIR")

Sorry I was late
btw... Outlook forms are EVIL


I believe you could also use

objFSO.Copy "C:\Initial File\Dir\test.txt", "%ADMIN%\"

__________________
<< Insert exceedingly large and overly verbose message of how 1337 you are here including full specs of every vehicle you've ever driven and PC you've owned >>

Last edited by vass0922; 01-15-2004 at 12:48 PM.
vass0922 is offline   Reply With Quote
Old 01-15-2004, 02:41 PM   #5 (permalink)
Registered User
 
DVNT1's Avatar
 
Join Date: Oct 2001
Location: Ohio
Posts: 5,577
DVNT1 is on a distinguished road
Thanks for the reply vass0922 !
DVNT1 is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 07:21 AM.