![]() |
VOOZH | about |
Java, Unix, computers and life of small developer of a big system
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