Shoutbox

Environmental variables in C# - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Environmental variables in C# (/showthread.php?tid=88457)

Environmental variables in C# by djdannyp on 01-15-2009 at 08:31 AM

I'm trying to use this code to check for the presence of Windows Defender:

code:
if (File.Exists("%ProgramFiles%\\Windows Defender\\MSASCui.exe") == true)

However it doesn't work, lol.  It returns that windows defender isn't installed, even though it 100% is.

This is definitely the problem as if i change it back to look for C:\Program Files\Windows Defender\MSASCui.exe then it finds it.

Any ideas what I'm doing wrong?
RE: Environmental variables in C# by ShawnZ on 01-15-2009 at 08:55 AM

use Environment.GetFolderPath(SpecialFolder.ProgramFiles) :p


RE: Environmental variables in C# by djdannyp on 01-15-2009 at 12:08 PM

Could you show me using the example I've got there?

I'm pretty much a novice when it comes to coding, I can edit stuff that's already there (just about)......but most other stuff is COMPLETE trial and error!

Edit: n/m.....got it sorted.....i think


RE: Environmental variables in C# by ShawnZ on 01-15-2009 at 01:32 PM

if (Directory.Exists(Environment.GetFolderPath(SpecialFolder.ProgramFiles) + @"\Windows Defender\MSASCui.exe"))

:p