Powershell dynamic path when create folder -
i want create folder, don't know how use variable define path.
as is:
new-item -itemtype directory -path "c:\users\tizio.caio\desktop\backup_$((get-date).tostring('yyyymmdd'))"
i want replace c:\users\tizio.caio\desktop\
variable in order make future reworks easier.
i split directory , filename, , use environment variable userprofile
$var = $env:userprofile + "\desktop\" $backup = "backup_$((get-date).tostring('yyyymmdd'))" new-item -itemtype directory -path "$var$backup"
Comments
Post a Comment