Chirag Nagrekar has Published 468 Answers

How to start any program using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 08:01:03

If you have noticed, you can start notepad and calculator or other standard system utilities with the Windows Run or through the PowerShell console directly by typing just their names, but not the wordpad.exe, word, excel or any other application. It will throw an exception.For example, just type notepad.exe in ... Read More

How to use PowerShell as a Calculator? Or How to use PowerShell for arithmetic operations?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 08:00:00

You can use the PowerShell console to perform arithmetic operations, the same way the calculator does.To do the addition operation, 2+3Output − 5For complex, additional operations as well it is too quick.10024455 + 554668 + 9964455Output − 20543578Floating numbers operation, 5569899.65 + 554886.32Output − 6124785.97To perform subtract operation, 55564488556 - ... Read More

How to overwrite or remove PowerShell alias?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 07:58:30

You can overwrite the Powershell alias by redefining it. For example, if the alias is created Edit for Notepad.exe and if you want to overwrite it with another program, say wordpad.exe then use the below command.We will overwrite the Edit alias cmdlet with Wordpad.exe using the Set-Alias command. When you ... Read More

How to add/remove values in the array in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 06:47:06

An array is always a fixed size. To add value to the array, you need to create a new copy of the array and add value to it. To do so, you simply need to use += operator.For example, you have an existing array as given below.$array = 1, 2, ... Read More

How to create an array in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 06:41:14

To create or declare an array in PowerShell, there are few methods.You can directly assign values to the variable and separate it by comma (, ) and that variable becomes the variable.For example, $a = "Apple", "Dog", "Cat", "Banana", "Camel"$a is now an array. To access the variable you can ... Read More

What is Array in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 14-Feb-2020 06:40:16

An array is consists of a set of elements of the same data types or the different data types. When the output consists of more than one line then output or stored variable automatically becomes the Array. Its data type is Object[] or ArrayList and base type would be System.array ... Read More

How to change the size of the Console using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:05:01

You can change the size of the PowerShell Console with GUI and CLI both.With GUI −With CLI −To change the Width of the console,$host.UI.RawUI.WindowSize.Width = 150To change the Height of the console,$host.UI.RawUI.WindowSize.Height = 60

How to change the Foreground color or Font color of the console using PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:03:21

Font color is termed as the Foreground color in the PowerShell. To change the font color you can use the console GUI property “Screen Text”. There are various 16 colors available and you can change RGB properties as well.CommandTo change the color with the script, use the below command.$Host.UI.RawUI.ForegroundColor = ... Read More

How to get only folders but not the files in the Get-ChildItem in PowerShell?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:02:54

To get only folders excluding files, we need to use –Attribute parameter with Directory attribute.CommandGet-ChildItem D:\Temp\ -Attributes DirectoryOutputDirectory: D:\Temp Mode                LastWriteTime         Length Name ----                -------------         ------ ---- d----- ... Read More

How to change the Title of the console using PowerShell command?

Chirag Nagrekar

Chirag Nagrekar

Updated on 23-Jan-2020 08:02:29

For various reasons, you need to change the title of the PowerShell console. Like the title to describe the script. For example, System Information or Service Information.To change the PowerShell Console Title use the “WindowsTitle” property in RawUI. It is just a temporary change. When you close the console and ... Read More

Advertisements