How do I make these two lines of PowerShell into one:
$tmp=([Environment]::GetFolderPath("MyDocuments"))
mkdir $tmp\foo\bar
PowerShell seamse to treat this as two lines if i try:
mkdir ([Environment]::GetFolderPath("MyDocuments"))\foo\bar
CodePudding user response:
Better use PowerShell cmdlets specially designed for that:
New-Item -Path (Join-Path -Path ([Environment]::GetFolderPath("MyDocuments")) -ChildPath "foo\bar") -ItemType Directory -Force