Ok so i want to create a file

File.Create("..."):

I want it to be able to detect the user that is on so it automatically creates it on there desktop. Is this possible.

// Creates a file called "test.txt" on the currently logged-in
// user's desktop
File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\testfile.txt");

// Or if you only want to find out the user that is currently logged in
String userName =  Environment.GetEnvironmentVariable("username");
// Creates a file called "test.txt" on the currently logged-in
// user's desktop
File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\testfile.txt");

// Or if you only want to find out the user that is currently logged in
String userName =  Environment.GetEnvironmentVariable("username");

Ok, Thank that was easy enough.


Thanks


-T

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.