Function Create-MyFoldler
{
Param([string]$rootPath= $(throw"$rootPath required."), [string]$subFolder)
if ([System.String]::IsNullOrEmpty($subFolder))
{
$folderToCreate=$rootPath
write-host "Output 1:-" + $folderToCreate
}
else
{
$folderToCreate=Join-Path$rootPath$subFolder
write-host "Output 2:-" + $folderToCreate
}
if (![IO.Directory]::Exists($folderToCreate))
{
New-Item $folderToCreate -ItemType directory
write-host "Output 3:-" + $folderToCreate
}
}
Create-MyFoldler -rootPath "c:\test"