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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -