PDA

View Full Version : How can you copy a file to the system32 ??


AAQ
06-06-2005, 07:29 AM
Hi,

How can you determine where is windows installed?
I need to copy a file to the system32 folder in windows, the install needs to be able to switch regardless of windows installation, eg:

win98 = no system32 folder, install normally in c:
winnt4 = c:\winnt\system32, what happens in dual boot systems?
win2k = c:\winnt\system32, what happens in dual boot systems? what happens when installed in D:\winnt\system32
Xp = back to windows\system32

can anyone please help me? i need to copy a file but dont know how to find out the drive letter of the windows installation

rhosk
06-06-2005, 07:48 AM
The Global Variable "_SystemFolder" is the standard "system" folder under the windows folder, whether it be "system32" for the newer OS's or plain ol' "system" folder under say, WIN98 installs. It will locate the [system] folder, even if the windows install folder was manually changed.

HTH

AAQ
06-07-2005, 07:47 AM
Thanks rhosk .

I try this code and it is work ok

Windows

File.Copy("AutoPlay\\Docs\\NewMedia\\*.*", _WindowsFolder .. "\\Media", false);


======
system32

File.Copy("AutoPlay\\Docs\\Test.txt", _SystemFolder .. "\\Text.txt", false);

======
Thanks again