Powershell

Finding Empty Folders

To find out all folders that contain no files, you can use this line: dir -recurse | Where-Object { $_.PSIsContainer } | Where-Object {...

read more

List Hidden Files

Did you notice that Dir, ls or Get-ChildItem do not return hidden files? To see hidden files, you need to specify the -force parameter: Dir...

read more

Advanced String Filtering

In a previous tip, you learned how Select-String can filter string arrays based on a keyword. Have a look: route print | Select-String 127.0.0.1...

read more

Filtering Command Results

PowerShell captures any output from any command you enter. This is why you can always store command results in a variable, even with native...

read more

Wait For Key Press

Sometimes you'd like to wait for a key press. The easiest way is to use Read-Host like this: Read-Host 'Please press ENTER' | Out-Null...

read more

Avoid Format-… in Scripts

The family of Format-... Cmdlets is useful for outputting data into the console. You probably often used lines like this: Get-Service | Format-Table...

read more

Conflicting Commands

PowerShell supports many different command categories and searches for the command in the following order: 1. Alias 2. Function 3. Cmdlet 4....

read more

Finding Alias Names

To find out all alias names associated with a given command, filter the alias list by its definition property. The following command lists all...

read more