From fca51612cdf15b599b346258116f7495d34c5435 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Wed, 28 Mar 2018 21:40:15 +0200 Subject: [PATCH] ExecCommand() now display 'file not found' if the path not exist --- cleanW10.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index b4e40ef..aae06e3 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -523,6 +523,7 @@ function DelFile { write-Host -ForegroundColor DarkRed $Error[0].Exception.Message } } + function ExecCommand { param ( [cmdletbinding( @@ -539,7 +540,7 @@ function ExecCommand { $args = $params.arguments.Replace("##mod_path##", $script:current_module_path) Write-Host -NoNewline "`tExecute : $path : " $path = Invoke-Expression """$($path)""" - if ( -not (Test-Path $path) -and -not $path -eq "powershell" ) { + if ( -not (Test-Path $path) -or -not $path -eq "powershell" ) { Write-Host -ForegroundColor Yellow "File not found" return }