Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force not working in non-interactive mode

Tags:

powershell

Deleting folder 'C:\agent\_work\2\a\Foo\_PublishedWebsites\Foo\sourcejs'

Remove-Item : Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.
At C:\agent\_work\2\s\Build\Deployment\PrepareWebsites.ps1:29 char:2
+ Remove-Item -Path $source -Force -Confirm:$false | Where { $_.PSIsContainer }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Remove-Item], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RemoveItemCommand

Process completed with exit code 1 and had 1 error(s) written to the error stream.

I have tried adding -Force and -Confirm:$false but I still get this error. Using TFS 2015 builds. Anyone got any ideas?

like image 972
Space Monkey Avatar asked Jul 12 '16 16:07

Space Monkey


1 Answers

Remove-Item -path 'C:\agent\_work\2\a\Foo\_PublishedWebsites\Foo\sourcejs\*' -Recurse -Force -EA SilentlyContinue -Verbose
like image 158
DisplayName Avatar answered Sep 18 '22 00:09

DisplayName