PowerShellGuard icon indicating copy to clipboard operation
PowerShellGuard copied to clipboard

New-Guard does not support spaces in path.

Open fabienmazieres opened this issue 7 years ago • 0 comments

The New-Guard command does not like me giving it a folder name with spaces in it. I tried many work around but I cannot find a way to protect the path. I am happy to help with debugging if I am given some guidance where to inject some code.

I have made a small module to create the guards I need, based on VSCodeWatcherTask Watch-Project -WorkspaceRoot "c:\Users\fma146\OneDrive - Maersk Group\PowerShell\Build" -Type Project

which basically runs: New-Guard -Path "$WorkspaceRoot" -PathFilter "*.ps1" -MonitorSubdirectories -TestPath "$WorkspaceRoot\Tests" -TestCommand { Write-Host "Invoking Watch.Project" Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true} } -Wait

which, when tests complete, results in: Tests completed in 5.24s Passed: 42 Failed: 0 Skipped: 0 Pending: 0 Inconclusive: 0 Exception calling "InvokeScript" with "1" argument(s): "The term 'C:\Users\fma146\OneDrive' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if apath was included, verify that the path is correct and try again." At C:\Users\fma146\Documents\WindowsPowerShell\Modules\PowerShellGuard\0.8.68\PowerShellGuard.psm1:195 char:7 $ExecutionContext.InvokeCommand.InvokeScript($Command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CategoryInfo : NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId : CommandNotFoundException

fabienmazieres avatar Jan 19 '18 14:01 fabienmazieres