Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

What Were You Working On?

Posted on August 21, 2015August 21, 2015

toolboxIt probably comes as no surprise that I write a lot of PowerShell code. Like you, I'm usually working on several projects at the same time, most often using the PowerShell ISE. When I fire up the PowerShell ISE I often go to most recently edited files and re-open the files I was last working on. But sometimes my list of current projects gets pushed aside by other files I might open and edit. Because I like to be lazy (I mean efficient) I decided to come up with a solution to make it easy to open files I'm actively developing.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

In the PowerShell ISE you can easily load a file into the editor with the PSEDIT command.

Psedit $profile

So all I need is a way to store my active files. It is simple enough to use a text file. All the text file needs is a list of full file paths. Opening all the files can be as easy as this:

psedit (get-content .\currentWork.txt)

But how can I easily add a file to the list? I can use the PSISE object model to get the path for the currently active script file and add it to the file.

$psise.CurrentFile.FullPath | Out-File -FilePath .\currentwork.txt -Encoding ascii -Append

To remove a file from the list, it is probably easiest to simply open the current work list using PSEDIT and manually delete what I no longer need. I took these core commands and wrapped them in a set of functions. And of course, I don't want to have to type any more than I have to so it would be handy to add some shortcuts to the ISE Add-On menu.

$work.submenus.Add("Add current file to work",{Add-CurrentProject -List $currentProjectList},"CTRL+Alt+A") | Out-Null
$work.submenus.Add("Edit current work file",{Edit-CurrentProject -List $currentProjectList},"CTRL+Alt+E") | Out-Null
$work.submenus.Add("Open current work files",{Import-CurrentProject -List $currentProjectList},"CTRL+Alt+I") | Out-Null

I ended up creating a set of functions for these key operations and incorporated them into my ISE Scripting Geek module. The module exports a global variable for my work list.

$CurrentProjectList = Join-Path -Path $env:USERPROFILE\Documents\WindowsPowerShell -ChildPath "currentWork.txt"

Now when I open the ISE I can press Ctrl+Alt+I and have immediate access to everything I'm currently working on. This has already saved me a lot of time and frustration.

I have moved the ISE Scripting Geek module to GitHub so check it out here. Feel free to pick and choose what you want from the module or take my commands here and create your own solution for loading your active work files. The functions for this particular feature are in CurrentProjects.ps1.

Enjoy and let me know if this starts saving you some time.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

2 thoughts on “What Were You Working On?”

  1. Mark Scardiglia says:
    October 5, 2015 at 6:28 pm

    This is awesome. Thanks. I usually have ps1 files all over the place in some state of incomplete. This will help. And it wouldn’t hurt to get a little more ruthless with stuff I know is junk.

    1. Jeffery Hicks says:
      October 5, 2015 at 7:26 pm

      This is exactly why I created this.

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d