Crispy13
Crispy13

Reputation: 369

Powershell set a variable and print but nothing

SET ML_PATH=E:\Workspace\Handson-ml2
echo $ML_PATH

printed nothing.

echo "ML_PATH = $ML_PATH"

printed just:
ML_PATH =

How could i set a variable in powershell and print the variable like echo of linux?

Upvotes: 1

Views: 527

Answers (1)

Martin Brandl
Martin Brandl

Reputation: 58931

You can define a variable in PowerShell using the $varname = syntax:

$ML_PATH = "E:\Workspace\Handson-ml2"
Write-Output $ML_PATH

Note: echo is an alias for the Write-Output cmdlet which you can determine using the Get-Alias cmdlet:

Get-Alias echo

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           echo -> Write-Output

Upvotes: 1

Related Questions