Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Path with variable

$
0
0

Hello

Can someone please help me?

#Example 1
C:\Temp\MyFile.txt

#Example 2
$MyPath = "C:\Temp"
$MyPath+'\MyFile.txt'

While example 1 opens MyFile.txt, example 2 with variable just echos "C:\Temp\MyFile.txt".
Why?

With a batch file that was no problem:
SET MyPath = "C:\temp"
%MyPath%MyFile.txt

Marc


Viewing all articles
Browse latest Browse all 8583

Trending Articles