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

Using environment variable to call an exe

$
0
0

Hello,

I'm trying to call a command in PowerShell using an environment variable.  Using cmd, I would call the exe using the following command %userprofile%\somefolder\random.exe.  When I use this command, $env:homepath\somefolder\random.exe, I get an unexpected token error.  Browsing the web, I found this command ~\somefolder\random.exe and this works, but I don't understand why it works and $env:homepath\somefolder\random.exe doesn't to call the script?

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles