Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the “$” symbol do in Powershell?

Tags:

powershell

I've seen the $ symbol used in PowerShell with every variable. Is there any specific use of this symbol?

like image 427
Devdutta Goyal Avatar asked Oct 26 '25 17:10

Devdutta Goyal


1 Answers

The dollar symbol in PowerShell variable is used to set/evaluate the value of that variable.

$Variable1 = hello

Above expression is to define a vriable by setting it a value hello. Here the variable name is Variable1, but with $ it is setting the Variable1 a value hello.

There are cmdlets to set variables where $ is not used.

Set-Variable -Name Variable2 -Value HelloWorld

And get cmdlet for the same.

Get-Variable -Name Variable2

PS: Above explanation is only for variables.

like image 60
Prasoon Karunan V Avatar answered Oct 29 '25 13:10

Prasoon Karunan V



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!