![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | how to set environment variable where name is not a-z nor A-Z i need to set source.dir environment variable in my scripts, if I use $env:source.dir=c:\source i got error like "Property 'dir' cannot be found on this object." Some one please help, thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: how to set environment variable where name is not a-z nor A-Z On 4 Dec 2006 11:43:45 -0800, hieulugia@gmail.com wrote: >i need to set source.dir environment variable in my scripts, if I use > >$env:source.dir=c:\source > >i got error like "Property 'dir' cannot be found on this object." > >Some one please help, thanks! The following should do what you want. cd env: new-item -path "source.dir" -value "C:\Source" or new-item -path "env:\source.dir" -value "C:\Source" Andrew Watt MVP |
My System Specs![]() |
| | #3 (permalink) |
| | Re: how to set environment variable where name is not a-z nor A-Z Or, more simply: ${env:source.dir} = "c:\source" Note that this also works with regular variables: ${variable with spaces} = "foo" and even with files: PS (1) > ${c:\a file.txt} = "Hello" PS (2) > get-content "c:\a file.txt" Hello -bruce -- Bruce Payette [MSFT] Windows PowerShell Technical Lead Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:hvu8n21aurkrughc0r41ta1en4kuv4v9om@4ax.com... > On 4 Dec 2006 11:43:45 -0800, hieulugia@gmail.com wrote: > >>i need to set source.dir environment variable in my scripts, if I use >> >>$env:source.dir=c:\source >> >>i got error like "Property 'dir' cannot be found on this object." >> >>Some one please help, thanks! > > The following should do what you want. > > cd env: > new-item -path "source.dir" -value "C:\Source" > > or > > new-item -path "env:\source.dir" -value "C:\Source" > > Andrew Watt MVP |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to set system's environment variable permanently | PowerShell | |||
| environment variable not seen | Software | |||
| Path Environment Variable - Vista 64-bit | Vista General | |||
| PATHEXT environment variable and PS1 scripts | PowerShell | |||
| how to set environment variable where name is not a-z nor A-Z | PowerShell | |||