[powershell] env variables help

May 16, 2010 at 22:47:37
Specs: Windows 7
lets say

cmd.exe
set abc=Stu

powershell
echo $env:abcpid

should output Stupid

How do I make it do that?

in linux all i need to do is have $(env:abc).. there anything similar that i can do here?

.


See More: [powershell] env variables help

Report •


#1
May 17, 2010 at 02:20:21
Why do you use PowerShell to achieve a so trivial result?

At prompt (cmd.exe) type

set abc=Stu
echo.%abc%pid

and you get Stupid just using plain command line statements.


Report •

#2
May 17, 2010 at 05:53:56
because:

$wshshell = New-Object -ComObject WScript.Shell
$lnk = $wshshell.CreateShortcut("$home\Desktop\InstallDrivers.lnk")
$lnk.TargetPath = "$env:repo\win7\netsetup\scripts\install_drivers.cmd"
$lnk.WorkingDirectory = "$env:repo\win7\netsetup\scripts"
$lnk.Save()

.


Report •

#3
May 17, 2010 at 06:43:01
In my time playing with POWERSHELL!, I've decided it's a great scripting language, but a crap CLI. You can tell it was made by the former VBS team, and said team has no real experience with CMD/COMMAND/KSH.
PS C:\> $abc = "foo"
PS C:\> Write-Host ($abc, "bar") -separator ""
foobar


Report •

Related Solutions

#4
May 17, 2010 at 09:09:47
are you kidding me lol, so i need an additional line to integrate that into the script eh.

.


Report •


Ask Question