C# WinDir
#1

Hi guys. I want to ask you

How can I change this
pawn Код:
private string GetSysFilePath()
        {
            string filepath = (@"C:\text.txt");
   
            return filepath;
        }
String "C:\text.txt" must be indenpence of each type of PC. Example windows could be installed on D: drive.
Exist some function like - "%systemroot%" or something like that. ? thanks
Reply
#2

You can use Environment.GetEnvironmentVariable for this.
Код:
Environment.GetEnvironmentVariable("SystemRoot")
Reply
#3

and what it is returning?
Reply
#4

Probably the system drive letter (C, D) etc. Why don't you look it up in the documentation?
Reply
#5

http://stackoverflow.com/questions/5...uch-as-c-drive
http://stackoverflow.com/questions/7...e-of-the-drive

https://www.******.hr/search?q=c+sha...hrome&ie=UTF-8

It's easy to search...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)