Some notes on software development... RSS 2.0
# Monday, 18 February 2008

To get the Windows folder you can use the static GetEnvironment method from the Environment class.
You need to pass in the name of the Environment variable, in this case WinDir, and it will return the correct Windows path regardless of which Windows OS the app is running on.

Environment.GetEnvironmentVariable("WinDir")

Other Environment variables available are:

  • APPDATA
  • COMPUTERNAME
  • FrameworkVersion
  • HOMEDRIVE
  • HOMEPATH
  • OS
  • SystemDrive
  • TEMP
  • USERNAME
  • USERDOMAIN
There are many others but they vary depending on the OS and applications installed. View all the Environment variables by running SET from a command line.


Monday, 18 February 2008 11:26:57 (GMT Standard Time, UTC+00:00)  #    -
C#
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Hadrian Phillips

All Content © 2018, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)