Skip to content

Instantly share code, notes, and snippets.

View fzed51's full-sized avatar
πŸ‘¨β€πŸ’»
I may be slow to respond.

Fabien S. fzed51

πŸ‘¨β€πŸ’»
I may be slow to respond.
View GitHub Profile
@ser1zw
ser1zw / dragdrop.ps1
Created March 22, 2012 17:48
PowerShell Drag & Drop sample
# PowerShell Drag & Drop sample
# Usage:
# powershell -sta -file dragdrop.ps1
# (-sta flag is required)
#
Function DragDropSample() {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object Windows.Forms.Form
$form.text = "Drag&Drop sample"
$listBox = New-Object Windows.Forms.ListBox
@jpoehls
jpoehls / Elevate-Process.ps1
Created December 14, 2011 20:34
Elevate-Process (sudo) for PowerShell
# Put this in your PowerShell profile.
function Elevate-Process
{
<#
.SYNOPSIS
Runs a process as administrator. Stolen from http://weestro.blogspot.com/2009/08/sudo-for-powershell.html.
#>
$file, [string]$arguments = $args
$psi = New-Object System.Diagnostics.ProcessStartInfo $file
@zippy1981
zippy1981 / DisplayImage.ps1
Created May 13, 2011 02:20
Display an image from Windows Powershell
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg')
#$file = (get-item "c:\image.jpg")
$img = [System.Drawing.Image]::Fromfile($file);
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274