Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest

Powershell Tips–PSEdit

I got this from watching a session from Jeffrey Snover at TechEd. It was a neat trick, and it’s worked better than what I used to do.

Editing files

Suppose I have the ISE open and I want to edit a file. I could easily do this:

psedit_a

Click File –> Open, or click the open Folder button, and get a dialog to open a file. I stopped doing that soon after I began playing with PowerShell because I was typing most of the time, and it was easier to do this:

psedit_b

Just type notepad and the filename, whether it exists or not, and have notepad open up. However working with notepad isn’t great because you lose intellisense and some of the other nice ISE features.

However today I saw this. Type psedit and a file (it has to exist).

psedit  attachdbs.ps1

And I see the file open above.

psedit_c

Very cool.

Of course, as I mentioned, the file needs to exist. If it doesn’t, then a CTRL+N will get you a new file, which you can save and then easily open from the command line the next time.


Filed under: Blog Tagged: powershell, syndicated

Comments

Leave a comment on the original post [voiceofthedba.wordpress.com, opens in a new window]

Loading comments...