Skip to content

Commit 5ca27c7

Browse files
authored
Update tiny11maker.ps1 - error handling param
error handling for param as we will later make the script agnostic to execution on OSDrive / $env:systemdrive
1 parent a5a4d97 commit 5ca27c7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tiny11maker.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@ if (! $myWindowsPrincipal.IsInRole($adminRole))
2929
exit
3030
}
3131

32-
param ($ScratchDisk)
33-
if ($Null -eq $ScratchDisk) {
34-
$ScratchDisk = $env:SystemDrive
32+
param (
33+
[ValidatePattern('^[c-zC-Z]$')]
34+
[string]$ScratchDisk
35+
)
36+
37+
if (-not $ScratchDisk) {
38+
$ScratchDisk = $PSScriptRoot -replace '[\\]+$', ''
39+
} else {
40+
$ScratchDisk = $ScratchDisk + ":"
3541
}
3642

43+
Write-Output "Scratch disk set to $ScratchDisk"
44+
3745
# Start the transcript and prepare the window
3846
Start-Transcript -Path "$PSScriptRoot\tiny11.log"
3947

0 commit comments

Comments
 (0)