Results for “PowerShell”
Small, practical examples. Search by task or narrow things down below.
Copy a file to a chosen destination
PowerShell: LiteralPath prevents wildcard characters in the source filename from being interpreted.
PowerShell✓ Tested
Count a result even when it is empty or has one item
PowerShell: Wrap pipeline results in an array subexpression for consistent Count behavior.
PowerShell✓ Tested
Count array elements
PowerShell: Count array elements using PowerShell 7.
PowerShell✓ Tested
Count days between calendar dates
PowerShell: Parse an unambiguous format before subtracting date values.
PowerShell✓ Tested
Create a portable relative path
PowerShell: Create a portable relative path using PowerShell 7.
PowerShell✓ Tested
Create an array of text values
PowerShell: Create an array of text values using PowerShell 7.
PowerShell✓ Tested
Create an object with named properties
PowerShell: Create an object with named properties using PowerShell 7.
PowerShell✓ Tested
Define a function with a parameter
PowerShell: Define a function with a parameter using PowerShell 7.
PowerShell✓ Tested
Delete only a named scratch file
PowerShell: Use LiteralPath and avoid recursive removal for a single known file.
PowerShell✓ Tested
Discard incidental output from a setup command
PowerShell: Out-Null prevents setup objects from becoming part of a function or script’s useful result.
PowerShell✓ Tested
Dispatch values with wildcard patterns
PowerShell: Switch -Wildcard interprets shell-style matching patterns for each clause.
PowerShell✓ Tested
Distinguish a file from a directory
PowerShell: Test-Path can constrain the kind of item that is accepted.
PowerShell✓ Tested