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!

System32 Folder

Status
Not open for further replies.

SteveMac32

Programmer
Jan 25, 2002
74
GB
Hi all,
I want to run a batch file that will move various specified files to the System32 folder at the moment I use:

For XP
copy ..\utilities\buildexe\buildexe.exe c:\windows\system32
2000 and below
copy ..\utilities\buildexe\buildexe.exe c:\winnt\system32

Is it possible to run one batch file for any operating system, what I want is to put these files in the system32 folder but without specifying ‘winnt’ or ‘windows’ in the file path. Someone has mentioned using %system% any ideas on this?

Thanks in advance

Steve
 
I battled with this for a long time a whiloe ago.

I got a lot of help from Pro's calling API's and a lot of other stuff.

In the end, someone helped me see the light with a fairly simple trick.

Ever heard of enviromental variables?

As far as I know, all windows versions registers at least one enviromental variable calle WinDir. It holds the value of the windows directory.

You can simply call WinDir in your code like a normal variable and use it like so:

Dim sys32Path as string
sys32Path = WinDir & "/system32"

I am also almost sure that you can specify eviromental variables to be set by your App's installation program...but I'm not sure. Anyway, WinDir should almost definately be there.

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
Sorry...

Dim sys32Path as string
sys32Path = WinDir & "\system32"


**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
Why not use the GetSystemDirectory() API?

Greetings,
Rick
 
LazyMe,
>Why not use the GetSystemDirectory() API

Because, although this is the VB forum, the question is asking about batch files...

SteveMac32,

Echo %SystemRoot%\System32
 
Uhm..
I also misunderstood the question

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
Sorry to cause the confusion, and posting it to this forum.

I do not know if I am doing this correctly or not but I replace:

copy ..\utilities\buildexe\buildexe.exe c:\winnt\system32
with
copy ..\utilities\buildexe\buildexe.exe Echo %SystemRoot%\system32

but it still does not work, I assume that I am incorrect somewhere any ideas

steve

 
Steve

Echo is a dos command used to print whatever is after the echo to the command prompt.

Echo Hello There

will print to the command prompt as:

Hello There

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
NP

**********************************
May the Code Be With You...
----------
x50-8 (X Fifty Eigt)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top