Windows Vista Forums

set-location - possible to use a variable?
  1. #1


    Thorsten A. Oeltjen Guest

    set-location - possible to use a variable?

    why does



    $MyValue = new-Psdrive -name YMAT -Psprovider FileSystem -root
    \\deingfle01.local.burkert.com\\nfs_bue\r3dnl_ymat\pin\0000 <enter>
    set-location $MyValue: <enter>

    doesnt't work?

    can't be set, because path is empty (sorry - error comes in german)

    an $MyValue <enter>



    gives me
    Name Used (GB) Free (GB) Provider Root
    CurrentLocation
    ---- --------- --------- -------- ----
    ---------------
    YMAT FileSystem
    \\deingfle01.local.burkert.com\\...


      My System SpecsSystem Spec

  2. #2


    Thomas Lee Guest

    Re: set-location - possible to use a variable?

    In message <ushHJKdyKHA.3304@newsgroup>, Thorsten A. Oeltjen
    <thorsten@newsgroup> writes

    >why does
    >
    >
    >
    >$MyValue = new-Psdrive -name YMAT -Psprovider FileSystem -root
    >\\deingfle01.local.burkert.com\\nfs_bue\r3dnl_ymat\pin\0000 <enter>
    >set-location $MyValue: <enter>
    >
    >doesnt't work?
    It's fairly simple really.

    $MyValue is a PSDrive. It has a Name parameter that would be used by
    default when you call Set5-Location. You want to use the object's Drive
    parameter.

    Try:

    Set-Location $myValue.drive
    --
    Thomas Lee
    doctordns@newsgroup

      My System SpecsSystem Spec

  3. #3


    Thorsten A. Oeltjen Guest

    Re: set-location - possible to use a variable?

    unfortunately there is no objectproperty drive

    Error that comes with:

    (the argument can't be processed, because the value of the argument
    "path" is NULL ....

    Set-Location : Das Argument kann nicht verarbeitet werden, da der Wert
    des Arguments "path" NULL ist. Ändern Sie den
    Wert des Arguments "path" in einen Wert ungleich NULL.
    Bei Zeile:1 Zeichen:13
    + set-location <<<< $myValue.drive
    + CategoryInfo : InvalidArgument: ( [Set-Location],
    PSArgumentNullException
    + FullyQualifiedErrorId :
    ArgumentNull,Microsoft.PowerShell.Commands.SetLocationCommand




    Am 22.03.2010 16:58, schrieb Thomas Lee:

    > In message <ushHJKdyKHA.3304@newsgroup>, Thorsten A. Oeltjen
    > <thorsten@newsgroup> writes

    >> why does
    >>
    >>
    >>
    >> $MyValue = new-Psdrive -name YMAT -Psprovider FileSystem -root
    >> \\deingfle01.local.burkert.com\\nfs_bue\r3dnl_ymat\pin\0000 <enter>
    >> set-location $MyValue: <enter>
    >>
    >> doesnt't work?
    >
    > It's fairly simple really.
    >
    > $MyValue is a PSDrive. It has a Name parameter that would be used by
    > default when you call Set5-Location. You want to use the object's Drive
    > parameter.
    >
    > Try:
    >
    > Set-Location $myValue.drive

      My System SpecsSystem Spec

  4. #4


    Thorsten A. Oeltjen Guest

    Re: set-location - possible to use a variable?

    Solution was realy simple ...

    Set-Location $myValue":"

    Am 23.03.2010 07:24, schrieb Thorsten A. Oeltjen:

    > unfortunately there is no objectproperty drive
    >
    > Error that comes with:
    >
    > (the argument can't be processed, because the value of the argument
    > "path" is NULL ....
    >
    > Set-Location : Das Argument kann nicht verarbeitet werden, da der Wert
    > des Arguments "path" NULL ist. Ändern Sie den
    > Wert des Arguments "path" in einen Wert ungleich NULL.
    > Bei Zeile:1 Zeichen:13
    > + set-location <<<< $myValue.drive
    > + CategoryInfo : InvalidArgument: ( [Set-Location],
    > PSArgumentNullException
    > + FullyQualifiedErrorId :
    > ArgumentNull,Microsoft.PowerShell.Commands.SetLocationCommand
    >
    >
    >
    >
    > Am 22.03.2010 16:58, schrieb Thomas Lee:

    >> In message <ushHJKdyKHA.3304@newsgroup>, Thorsten A. Oeltjen
    >> <thorsten@newsgroup> writes

    >>> why does
    >>>
    >>>
    >>>
    >>> $MyValue = new-Psdrive -name YMAT -Psprovider FileSystem -root
    >>> \\deingfle01.local.burkert.com\\nfs_bue\r3dnl_ymat\pin\0000 <enter>
    >>> set-location $MyValue: <enter>
    >>>
    >>> doesnt't work?
    >>
    >> It's fairly simple really.
    >>
    >> $MyValue is a PSDrive. It has a Name parameter that would be used by
    >> default when you call Set5-Location. You want to use the object's Drive
    >> parameter.
    >>
    >> Try:
    >>
    >> Set-Location $myValue.drive
    >


      My System SpecsSystem Spec

set-location - possible to use a variable? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
$Variable Is In {1,2,3,4} C S S PowerShell 3 23 Oct 2008
Why isn't Location a variable? RickB PowerShell 2 28 Jul 2008
BUG? Invalid location after Set-Location \\MyMachine Roman Kuzmin PowerShell 3 01 Apr 2008
Set-Variable Fred J. PowerShell 3 25 Oct 2006
How can I ensure that a variable is a built-in powershell variable? Sung M Kim PowerShell 7 22 Sep 2006