VOOZH about

URL: https://jdevel.wordpress.com/tag/powershell/

⇱ PowerShell | Development world stories


Development world stories

Java, Unix, computers and life of small developer of a big system

Posts Comments

Alias to open latest log file in Windows Power Shell

May 7, 2011 Leave a comment

Few days ago I’ve posted an alias to open latest log file of your application in bash shell. Same is possible on Windows environment if you use Windows Power Shell command interpreter. What you have to do is edit your profile.ps1 script and add a new function:

set-alias ed "C:/Program Files (x86)/Notepad++/notepad++.exe"
$global:app = "D:/MyApp"
function log {
 $myfile = ls $app/logs/*.log | sort -property lastwritetime | select -last 1
 ed $myfile
}

Of course change value for ed to your favorite editor/log viewer.
Here’s where you can read more about PowerShell profiles:
http://msdn.microsoft.com/en-us/library/bb613488(v=vs.85).aspx

Now just restart shell and execute log command.

Filed under Tools Tagged with PowerShell, Windows

Join 7 other subscribers

Create a free website or blog at WordPress.com.

%d
Design a site like this with WordPress.com
Get started