I want to use a variable for the path, instead of typing it manually
Instead of this
#create a folder
New-Item -Path 'D:\Test\New_folder' -ItemType Directory
to have something like this
$path='D:\Test'
#create a folder with a var
New-Item -Path '$path\New_folder' -ItemType Directory
But it is not working. I really appreciate any help you can provide.
$pathwill not get expanded. Either use double-quotes"or better, use the Join-Path cmdlet as inJoin-Path -Path $path -ChildPath 'New_Folder'