Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy to System Folder in Win200 and XP 2

Status
Not open for further replies.

smithy1981

IS-IT--Management
Sep 16, 2005
12
GB
Hi, I am trying to write a script that will copy files to the c:\windows or c:\winnt folder depending on the version of windows being used. Have tried using c:\%windir% but this just creates a folder called %windir%, is there a way of copying automatically to the correct folder or do you need to find the version of windows and then depending on that, hardcode the destination.

My current script looks as follows

Dim oCopy, oDest, oSource, oShell

Set oCopy = CreateObject("Scripting.FileSystemObject")

oDest = "c:\%windir%"
oSource = "c:\test"

oCopy.CopyFolder oSource, oDest


Thanks
 
A starting point:
Set S = CreateObject("WScript.Shell")
Set E = S.Environment("PROCESS")
T=E("windir")
WScript.Echo T

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
[1] %windir% includes in itself the drive letter already.
[2]
>[tt]oDest = "c:\%windir%"[/tt]
[tt]oDest = oShell.ExpandEnvironmentStrings("%windir%")[/tt]
(No trailing backslash is there, yet, if needed, oShell maybe that's what I think it is if you define it properly.)
oDest is a string, not an "object" yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top