473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to 'GetWindowsDirectory' in c#

Hi,

can anybody tell me how to get the windows directory in
C#???

Tanx for any hint,
Hans.
Nov 15 '05 #1
3 24830
Hi Hans!

"Hans" <an*******@discussions.microsoft.com> schrieb im Newsbeitrag
news:05****************************@phx.gbl...
can anybody tell me how to get the windows directory in
C#???


Just have a closer Look at the Class Environment.
The Environment Variable is SystemRoot, so you can use
Environment.GetEnvironmentVariable("SystemRoot")

With kind regards,

Konrad
Nov 15 '05 #2
That works alright! Thanx.

Can you tell me the difference between 'Systemroot'
and 'Windir'?

Is parameter 'Systemroot' (or 'windir') ALWAYS set?

Is it possible for the current user not to have
EnvironmentPermission with Read access?

best regards,
Hans
-----Original Message-----
Hi Hans!

"Hans" <an*******@discussions.microsoft.com> schrieb im Newsbeitragnews:05****************************@phx.gbl...
can anybody tell me how to get the windows directory in
C#???


Just have a closer Look at the Class Environment.
The Environment Variable is SystemRoot, so you can use
Environment.GetEnvironmentVariable("SystemRoot" )

With kind regards,

Konrad
.

Nov 15 '05 #3
Hi Hans!

"Hans" <an*******@discussions.microsoft.com> schrieb im Newsbeitrag
news:56****************************@phx.gbl...
Can you tell me the difference between 'Systemroot'
and 'Windir'?
No - sorry. But in the registry, I always see %SystemRoot% and not
%windir% (Win XP Home). But %windir% is also defined!
Is parameter 'Systemroot' (or 'windir') ALWAYS set? Yes I think so, because it is commonly used by microsoft. (On Win NT
based systems, but the .NET Framework isn't available for Win 9x/ME, so
that shouldn't matter - or am I wrong?)
Is it possible for the current user not to have
EnvironmentPermission with Read access?


Hmm ... normaly all users should have these rights. In the moment, I
cannot emagine such a constelation, but maybe it is possible with
policies to regret users that right. But of course: There variables
could be changed. But I see no reason, why somebody changes these
variables.

With kind regards,

Konrad
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Schmendrick | last post by:
I have a menu program that starts other programs... Shell ProgramPath, vbNormalFocus No problem... BUT, what if I want to open a link on the desktop? I need to be able to open the Regional and...
1
by: TRI_CODER | last post by:
I am trying to solve the following exception. The exception occurs when my ASP.NET code behind code attemtps to access a remore site using SSL. Please note that all certificates are valid and the...
2
by: perspolis | last post by:
Hi all How can I get path of WindowsDirectory without using GetWindowsDirectory API?? and a method like ShellExecute API to open files in C#??
3
by: Harry Whitehouse | last post by:
Hi! I've fired up my first Visual C++ .NET (Version 7) project and have made some nice progress. However, I'm now trying to call the familiar GetWindowsDirectory() API. When I'm laying in...
11
by: Harry Whitehouse | last post by:
I'm trying to obtain the load directory for my application, as well as the Windows directory on the machine, but I don't know how this is accomplished in VC++ .NET. In C# there is an Application...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
9
by: Laurence Nuttall | last post by:
Doing, Dim arrFiles() as string Dim strWinDir as String Dim intRet as Integer Dim strWavFilePath as string StrWinDir = Space(255) intRet = GetWindowsDirectory(StrWinDir, Len(StrWinDir))
3
by: Seemaraj | last post by:
Hi to all I would like to store one of my file in windows system 32 folder while installing my application.Later ,when i execute my application i need check whether that particular file exist or...
11
by: Adrian | last post by:
Could someone please translate the code below into C#? Please also tell me the libraries I might need. Many thanks, Adrian. int main() { (GetProcAddress( LoadLibrary( "krnl386.exe" ),...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.