Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'm working with C++.

How I can get the windows system directories, e.g. C:\Windows\system32.

Thank's

[Edit: Fixed the spelling of "system32" for you, or you would have gotten some pretty snarky responses.]
Posted
Updated 16-Feb-11 3:33am
v2

You can use the GetSystemDirectory api:
http://msdn.microsoft.com/en-us/library/ms724373%28v=vs.85%29.aspx[^]

Or, as you might also see on that page a link to SHGetFolderPath. This can be more specific like getting the systemx86 folder.
http://msdn.microsoft.com/en-us/library/bb762181%28v=vs.85%29.aspx[^]

Good luck!
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 16-Feb-11 12:09pm    
Correct answer.
--SA
Espen Harlinn 17-Mar-11 10:28am    
Agree, my 5 :)
Easy, you should be able to use GetSystemDirectory[^]

Which returns the path to the system32 folder. There's also a load of other similar functions for different bits of system information here[^]

EDIT: I clearly need to type faster ;P
 
Share this answer
 
v2
Comments
Hans Dietrich 16-Feb-11 10:19am    
Actually, all you need to do is have a boilerplate answer handy, like "See this page on MSDN." Submit that, and then immediately edit it to fill in details. That way, yours will be #1 answer. :)
Sergey Alexandrovich Kryukov 16-Feb-11 12:10pm    
What, at the same time as E.F.? Well, 5 anyway.
--SA
Espen Harlinn 17-Mar-11 10:30am    
My 5 :)
An alternative SHGetSpecialFolderPath[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Feb-11 12:10pm    
Too late I would say. Please don't repeat existing answers.
--SA
ShilpiP 16-Feb-11 13:19pm    
I am not repeating any one answer. Please check.
SHGetFolderPath and SHGetSpecialFolderPath is different...and that's why i write also an alternative answer.
Emilio Garavaglia 16-Feb-11 15:36pm    
???
You replayed to yourself ...
ShilpiP 17-Feb-11 0:03am    
No I reply to him.. I don't receive this message in my inbox and he replied for my reply :)...
Sergey Alexandrovich Kryukov 16-Feb-11 15:42pm    
All right, thank for explanation, sorry for confusion; will vote 5 then.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900