new-item -path "C:\Temp\$($env:USERNAME)_N_Files" -ItemType Directory
Powershell - making folder using $env:username
Hello,
I´m new with Powershell and I have script, where I need to make folder using $env:username plus something else - for ex. username is David_N and I need to have folder David_N_Files
I can only make folder called $env:username
Is it possible to make it with Powershell?
Thanks for reply
David Novotny
-
MotoX80 34,346 Reputation points
2022-02-17T15:09:19.91+00:00
1 additional answer
Sort by: Most helpful
-
Ben Kuong 0 Reputation points
2024-09-29T18:49:28.43+00:00 new-item -path "C:\Temp$($env:USERNAME)" -ItemType Directory
Copy-Item -Path "$env:USERPROFILE\AppData\Local\Microsoft\Edge\User Data\Default\Bookmarks" -Destination "C:\Temp$($env:USERNAME)\Edge"
Copy-Item -Path "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Bookmarks" -Destination "C:\Temp$($env:USERNAME)\chrome"
Add-Content -path C:\Temp\Rollback.ps1 -encoding String 'Copy-Item -Path "C:\Temp$($env:USERNAME)\chrome" -Destination "$env:USERPROFILE\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"
Copy-Item -Path "C:\Temp$($env:USERNAME)\Edge" -Destination "$env:USERPROFILE\AppData\Local\Microsoft\Edge\User Data\Default\Bookmarks"'