How to Create a Function in PowerShell

If you have worked with other programming languages, you have may used functions for code reusability. You can also create functions in PowerShell. PowerShell function example Below is the syntax of a simple function function hello-world { write-host "hello world"  } You can also pass parameters in a function using the param keyword function Get-TimesResult { Param ([int]$a,[int]$b) $c = ... Read more

Increase number of visible lines in cmd on Windows

Windows CMD Buffer Size

The Windows command-line only shows a history of 300 lines by default - this can be a nuisance especially if you are working with long list outputs. However, you can easily increase the number of lines that are shown. Open a cmd window, right-click the title bar, and select Properties. Go to the Layout tab and ... Read more

How to Delete a Folder Using Command Prompt of Windows

Delete Folder in Windows

To delete a folder using the command prompt of Windows, follow this procedure. Open a command prompt (Press the Windows icon key and R to open the run window). Type cmd and hit enter from the keyboard. On a command prompt, enter the following command and hit enter from the keyboard. Syntax rmdir /s <complete ... Read more

“No space left on device” error on empty drives

When you try to copy files from your hard drive to an external device such as an external hard drive or USB stick, you may get an error message saying that there is no free space left on your device, even though you just deleted everything to make room. This is most likely due to ... Read more

How to Call Functions in Powershell (Windows)

Functions in Powershell are called without any comma or parenthesis, although they are defined using them. The correct way to call a function with two variable parameters would be: test $local1 $local2 The wrong way is: test($local1, $local2) If you put parentheses around your parameters, your input is treated as an array and thus the ... Read more