How do I go about getting the info from the computers name and setting that location in a string.
Example*
string contents = File.ReadAllText(@"C:\Users\" + Settings.Default.User + "\\Documents\\My vs\\juice.txt");
Problem is, I cannot use the Setting.Default.User location because that name constantly changes.
I need that section to be some kind of variable that means the computers name.... I don't wanna just hard code in my computers name either because If I put this on my other computers then obviously the name would change
you are looking for Environment class:
you can use Environment.MachineName Property
Anyway if you need a special folder path you can use: Environment.GetFolderPath
there you can find all the special folder available Environment.SpecialFolder Enumeration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With