Install
openclaw skills install powershell-safe-chainChain PowerShell commands safely without &&. Use try/catch, ErrorAction, and proper sequencing for reliable Windows execution.
openclaw skills install powershell-safe-chainChain commands reliably on Windows PowerShell. No && anti-patterns.
PowerShell differs from bash:
&& does NOT work for command chaining\ vs /)Wrong:
mkdir test && cd test && echo done
Right:
$ErrorActionPreference = 'Stop'
try {
New-Item -ItemType Directory -Path test -Force
Set-Location test
Write-Host 'done'
} catch {
Write-Error "Failed at step: $_"
exit 1
}
# If-then pattern
if (Test-Path $file) {
Remove-Item $file
Write-Host "Deleted"
} else {
Write-Warning "File not found"
}
# Pipeline with error handling
Get-Process | Where-Object CPU -GT 100 | Stop-Process -WhatIf
$params = @{
Path = $filePath
Encoding = 'UTF8'
Force = $true
}
Set-Content @params
| Criteria | Verification |
|---|---|
No && in scripts | Select-String '&&' *.ps1 returns nothing |
| ErrorAction set | Select-String 'ErrorAction' *.ps1 matches |
| try/catch present | `Select-String 'try |
| Paths use Join-Path | Select-String 'Join-Path' *.ps1 matches |
[SecureString] for passwords$env:VARUse when:
Chain safely. Fail explicitly.