What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Environmental variables in C#

Environmental variables in C#
Author: Message:
djdannyp
Elite Member
*****

Avatar
Danny <3 Sarah

Posts: 3546
Reputation: 31
37 / Male / Flag
Joined: Mar 2006
O.P. Environmental variables in C#
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?
[Image: 1ftt0hpk-signature.png]
AutoStatus Script || Facebook Status Script
5222 days, 21 hours, 23 minutes, 37 seconds ago
01-15-2009 08:31 AM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Environmental variables in C#
use Environment.GetFolderPath(SpecialFolder.ProgramFiles) :p

This post was edited on 01-15-2009 at 08:56 AM by ShawnZ.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
01-15-2009 08:55 AM
Profile PM Web Find Quote Report
djdannyp
Elite Member
*****

Avatar
Danny <3 Sarah

Posts: 3546
Reputation: 31
37 / Male / Flag
Joined: Mar 2006
O.P. RE: Environmental variables in C#
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

This post was edited on 01-15-2009 at 01:01 PM by djdannyp.
[Image: 1ftt0hpk-signature.png]
AutoStatus Script || Facebook Status Script
5222 days, 21 hours, 23 minutes, 37 seconds ago
01-15-2009 12:08 PM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Environmental variables in C#
if (Directory.Exists(Environment.GetFolderPath(SpecialFolder.ProgramFiles) + @"\Windows Defender\MSASCui.exe"))

:p
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
01-15-2009 01:32 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On