GetCurrentDirectory()
returns the current directory as a string. CreateDirectory($dir)
creates the directory $dir
, if it doesn't already exist, and then returns the object that refers to the new or already existing directory. $dir = [System.IO.Directory]::CreateDirectory("$env:temp/a/b/c/d/e/f/g/h") start-sleep 5 $dir = [System.IO.Directory]::CreateDirectory("$env:temp/a/b/c/d/e/f/g/h") (new-timeSpan $dir.creationTime (get-date)).Seconds remove-item $env:temp/a -force -recurse