header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Current directory in Cmdlet
Last Post 18 May 2010 06:40 AM by closer. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
closerUser is Offline
New Member
New Member
Posts:5
Avatar

--
18 May 2010 03:09 AM
    Hello, All

    I have created own Cmdlet on C# and now I have a problem with detection of current directory. The Environment.CurrentDirectory property return path to directory with snap-in but I want to have a path to current directory selected PowerShell window.

    How can I retrieve path to current directory?

    Thanks
    closerUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    18 May 2010 06:40 AM
    I have found solution. I have made class which inherited from PSCmdlet (instead Cmdlet). Then I execute the following code for retrieve current directory:

    var currentDirectory = ((PathInfo)GetVariableValue("pwd")).Path;

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer