I convert a bunch of slide decks to word processor handouts used in our trainings. Since there are over 100 decks and powerpoint ends up using Gb's of RAM once it has finished and is doing nothing anymore, I thought I would clear the clipboard.
Tangent: something uses Gb's of RAM and remains idle? Sounds like Microsoft hired some SAP developers.
Anyway, this is how I chose to solve the problem in a nice powershell script:
$a = [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$b = [Windows.Forms.Clipboard]::Clear()
To run this, you must start powershell.exe single-threaded:
powershell -sta myscript.ps1
BTW, sounds strange that powershell starts multi-threaded by default, however, it makes absolutely no sens at all that powershell cannot run this single-threaded shit in a multi-threaded instance.
I can understand that you cannot run multi-threaded shit in a single-threaded instance of powershell, makes sense, but the opposite is just plain fucked up, no ifs, buts, or maybes.
Enjoy
Affichage des articles dont le libellé est Powershell. Afficher tous les articles
Affichage des articles dont le libellé est Powershell. Afficher tous les articles
jeudi 14 mars 2013
lundi 10 novembre 2008
Windows PowerShell and regex?
Yesterday, I was researching PowerShell for work and I was quite impressed, it is pretty powerful! I obviously cannot stand the hype and self-satisfied twits making over-enthusiastic remarks in the Windows PowerShell Owner’s Manual like:
To impress your colleagues, show them "dot source", if they are not impressed, nothing will impress them ...
"dot source", lol, that has been around for decades ;-), even on Windows with Microsoft's own ksh (i.e. in the Unix Services 4 Windows) ...
What does impress me in PowerShell, is the wmi integration, that is really cool! Also, the PowerShell is very good in interacting with .Net objects, as it can pass objects between different 'cmdlets' instead of strings, unlike most shells.
Regex is there as well, well, actually, sort of ....
Because, when the twits over at Redmond implement a standard, why, YES, WHY can't they stick to the standard? Look at regex for powershell, it is not case sensitive by default, not greedy and worse of all, '?' and '*' have all of a sudden become '.?' and '.*', respectively! How can they call that regex? There are certainly other things I have overlooked .... I would call the implementation Glogex or RegGlobex - they merged GLOB with regular expressions ...
The regex implementation in vbs is much better, as it has not been merged with GLOB!
I often use this regex cheat sheet, compare that to what is said here.
To impress your colleagues, show them "dot source", if they are not impressed, nothing will impress them ...
"dot source", lol, that has been around for decades ;-), even on Windows with Microsoft's own ksh (i.e. in the Unix Services 4 Windows) ...
What does impress me in PowerShell, is the wmi integration, that is really cool! Also, the PowerShell is very good in interacting with .Net objects, as it can pass objects between different 'cmdlets' instead of strings, unlike most shells.
Regex is there as well, well, actually, sort of ....
Because, when the twits over at Redmond implement a standard, why, YES, WHY can't they stick to the standard? Look at regex for powershell, it is not case sensitive by default, not greedy and worse of all, '?' and '*' have all of a sudden become '.?' and '.*', respectively! How can they call that regex? There are certainly other things I have overlooked .... I would call the implementation Glogex or RegGlobex - they merged GLOB with regular expressions ...
The regex implementation in vbs is much better, as it has not been merged with GLOB!
I often use this regex cheat sheet, compare that to what is said here.
Inscription à :
Articles (Atom)