Rework message output for ExecCommand()
This commit is contained in:
parent
10eecf17f5
commit
5e9148b111
1 changed files with 6 additions and 6 deletions
10
cleanW10.ps1
10
cleanW10.ps1
|
@ -589,20 +589,20 @@ function ExecCommand {
|
|||
)
|
||||
$path = $params.path.Replace("##mod_path##", $script:current_module_path)
|
||||
$args = $params.arguments.Replace("##mod_path##", $script:current_module_path)
|
||||
Write-Host -NoNewline "`tExecute : $path : "
|
||||
Write-Host "`n`tExecute $path : "
|
||||
$path = Invoke-Expression """$($path)"""
|
||||
if ( -not ((Test-Path $path) -or $path -eq "powershell") ) {
|
||||
Write-Host -ForegroundColor Yellow "File not found"
|
||||
Write-Host -ForegroundColor Yellow "`t`tFile not found"
|
||||
return
|
||||
}
|
||||
try {
|
||||
Start-Process -NoNewWindow -wait -filepath $path -ArgumentList $args
|
||||
Start-Process -NoNewWindow -wait -filepath $path -ArgumentList $args -ErrorAction Stop
|
||||
Write-Host -ForegroundColor Green "`t`tExecution done"
|
||||
}
|
||||
catch {
|
||||
Write-Host -NoNewLine -ForegroundColor Red "Error`n`t"
|
||||
Write-Host -NoNewLine -ForegroundColor Red "`tError`n`t`t"
|
||||
Write-Host -ForegroundColor DarkRed $Error[0].Exception.Message
|
||||
}
|
||||
Write-Host "`n"
|
||||
}
|
||||
|
||||
function ProcessModuleFile {
|
||||
|
|
Reference in a new issue