RE: windows power shell

  • From: "Jim Schulz" <jim.schulz@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 15 Jul 2011 07:53:37 -0500

$env:<name> (such as $env:computername) will do the trick in powershell.

type "powershell get-help about_env -detail" for more info.

The "env:" syntax can be used for other purposes such as listing all the
variables:

    dir env:

but for just referencing values the $env:<name> syntax is the way to go.

Jim

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Johannes Grib
Sent: Friday, July 15, 2011 1:08 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: windows power shell

Hi, 
All environment vars is under env: 
sl env:
gci wil give you the list,
sc and gc to set and get content.
HTH


-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Friday, July 15, 2011 4:36
To: bprogramming
Subject: windows power shell

Greetings.
I am on windows 7 and am trying to run some batch commands, for which I need

to know what is the syntax to get at the value of an environment variable?
I try %PATH%, %PATH, and even $PATH like in unix, but it all fails to expand

the value of the variable.
Since power shell apparently supports such unix-esque names as ls and pwd, I

am perplexed how to get it to pick up arguments.

BTW:
echo $PATH
prints nothing, whereas the % signs just get passed through as if it is not 
a special syntax, as in a dos window.

So I suppose I'll get rid of power shell and use the dos window where the 
args are predictable.

Now in the time it took to type this I could have done that.  Comments 
welcome.
Thx.
--le 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: