Skip to content

Commit 91d55f0

Browse files
committed
Remove domain to user name
1 parent 8d19ae0 commit 91d55f0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

SaveWin10Pictures/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ private static void Main()
1414
List<string> files = new List<string>();
1515
int counter = 0;
1616
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
17+
// remove domain if any
18+
if (userName.Contains("\\"))
19+
{
20+
userName = userName.Split('\\')[1];
21+
}
22+
1723
string imagePath = $@"C:\Users\{userName}\Pictures";
1824
if (Directory.Exists($@"C:\Users\{userName}\Pictures\fond_ecran"))
1925
{

0 commit comments

Comments
 (0)