delete temp directory if already exists
This commit is contained in:
@@ -6,6 +6,13 @@ LogMsg "Creating: ${TEMPDIR}"
|
||||
Try { New-Item -Path $TEMPDIR -ItemType Directory -Force -ErrorAction Stop }
|
||||
Catch { LogErr $_.Exception.Message ; Exit }
|
||||
|
||||
# Recursively delete $TEMPDIR if it already exists
|
||||
If ( Test-Path $TEMPDIR ) {
|
||||
LogMsg """${TEMPDIR}"" already exists and will be deleted"
|
||||
Try { Remove-Item -Path $TEMPDIR -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
# Write $CONFIG to install_config.ini
|
||||
Try { $CONFIG | Out-File -FilePath "${TEMPDIR}\install_config.ini" -Force -ErrorAction Stop }
|
||||
Catch { LogMsg "Cannot write configuration file! This script will exit." ; LogErr $_.Exception.Message ; Exit }
|
||||
|
||||
Reference in New Issue
Block a user