C# Console Delete Directory With any username

Nico Verdetto 1 Reputation point
2020-12-03T05:28:37.74+00:00

Ok so basically I am making a spoofer to unban you from FiveM and its going good and it works but not everyone is gonna have my username on my desktop so for example if its C:/Users/nicov/ and theres is C:/Users/richard/ it wont delete the folder for them because our usernames are different so is there a way I can bypass that and make it so it deletes the file for every username like a code like this C:/Users/$[USERNAME]/Appdata/ cause I really need a fix to this FAST!!!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,011 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 45,701 Reputation points
    2020-12-03T14:05:33.377+00:00

    Managed code can get user-specific folder paths with system.environment.getfolderpath. You just need to specify the folderpath to be returned by passing the desired system.environment.specialfolder

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.