This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PowerShell -NoP -C "&([ScriptBlock]::Create((Get-Content '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" & exit | |
# by earthdiver1 | |
################################################################################################################################### | |
$src_file = "C:\:somedir\important_file.doc" | |
$dst_dir = "D:\backup" | |
$num_copy = 20 | |
$interval_1 = 180 | |
$interval_2 = 15 | |
################################################################################################################################### | |
$ErrorActionPreference = "Stop" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Powershell -NoP -C "$input|&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & pause & exit/b | |
@Powershell -NoP -C "$PSCommandPath='%~f0';$PSScriptRoot='%~dp0'.TrimEnd('\');$input|&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & pause & exit/b | |
@Powershell -NoP -C "$input|.([ScriptBlock]::Create('$MyInvocation.MyCommand|Add-Member -M NoteProperty -Na Path -V ''%~f0'';$PSCommandPath=''%~f0'';$PSScriptRoot=''%~dp0''.TrimEnd(''\'');'+(gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & pause & exit/b | |
@setlocal EnableDelayedExpansion&set a=%*&(if defined a set a=!a:"=\"!)&Powershell -NoP -C "$PSCommandPath='%~f0';$PSScriptRoot='%~dp0'.TrimEnd('\');$input|.([ScriptBlock]::Create(((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)-replace'(?is)(^^(?:(?(o)(?:(?^!<#|@[''\""])[^^\s#''\""()])+|(?^!))|\s+|#[^^\n]*\n|<#(?:[^^#]|#(?^!>))*#>|''(?:[^^''`]|`.)*''|\""(?:[^^\""`]|`.)*\""|@''(?:(?^!\n''@).)*\n''@|@\""(?:(?^!\n\""@).)*\n\""@|\[(?:Alias|CmdletBinding)[^^\]]*\]|\[Ou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@Powershell -NoP -W Hidden -C "$PSCP='%~f0';$PSSR='%~dp0'.TrimEnd('\');&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & exit/b | |
# by earthdiver1 V1.05 | |
if ($PSCommandPath) { | |
$PSCP = $PSCommandPath | |
$PSSR = $PSScriptRoot | |
$code = '[DllImport("user32.dll")]public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);' | |
$type = Add-Type -MemberDefinition $code -Name Win32ShowWindowAsync -PassThru | |
[void]$type::ShowWindowAsync((Get-Process -PID $PID).MainWindowHandle,0) | |
} | |
Add-Type -AssemblyName System.Windows.Forms, System.Drawing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Powershell -NoP -C "&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & exit/b | |
# by earthdiver1 | |
[CmdletBinding(PositionalBinding=$False)] | |
Param( | |
[parameter(Position=0)][String]$Target, # IP address of the target host | |
[String]$Source, # if you have multiple interfaces (optional, default value: 0 (all interfaces)) | |
[Alias("n")][Int]$Count=4, # the number of ARP requests to send (optional, default value: 4) | |
[Int]$Interval=1 # the interval between ARP requests, in seconds (optional, default value: 1) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Numerics | |
<# | |
.SYNOPSIS | |
A tool that enables the use of the PowerShell console as a scientific calculator. | |
.DESCRIPTION | |
Accepts standard mathematical expressions as input and outputs the results on the console by | |
internally converting the expressions into forms that PowerShell can parse. | |
If no expression is specified as an argument, a read-eval-print-loop (REPL) session will start. | |
Intended for interactive use. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
A grep-like tool with a color highlighting feature. | |
.DESCRIPTION | |
This function searches for text patterns in input strings. | |
If input is an object, it is converted to a string prior to processing. | |
Matched characters are highlighted. | |
'(some command) | Select-MatchedString -Pattern <regex>' |