Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
PowerShell Development
>
Cmdlet Development
Current directory in Cmdlet
Last Post 18 May 2010 06:40 AM by
closer
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
closer
New Member
Posts:5
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
closer
New Member
Posts:5
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.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
PowerShell Development
>
Cmdlet Development
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2