pwsh 对一组 IP 进行排序
# 将 ip 转为 int 值 function Convert-IPv4ToInt { param ( [string]$ipAddr ) $ip = $ipAddr.Split(':')[0] $ipAddress = [System.Net.IPAddress]::Parse($ip) # 获取小端序整数 $littleE…
|
37
|
|
28 字
|
2 分钟
pwsh 处理 yaml 文件
$ErrorActionPreference = 'Stop' $ipText = @" 10.10.103.31 10.10.103.61 "@ [string[]]$ipArry = $ipText.Split([char[]]"`r`n") | % { $_.Trim() } | ?…
|
81
|
|
103 字
|
6 分钟
pwsh 使用 RunspacePool 进行并发操作
# 创建运行空间池 $runspacePool = [RunspaceFactory]::CreateRunspacePool(1, 100) # 创建运行空间池 最大 100 个 $runspacePool.Open() $fakeIdDcit = @{} $fakeIdDcit["9D370B71F76FC2"] = 1 $…
|
108
|
|
76 字
|
4 分钟
pwsh windows 检测代理IP
$ipTxt = @" 1.1.1.1 2.2.2.2 3.3.3.3 "@ # 将 ip 文本拆分为数组 [string[]]$ips = $ipTxt.Split([char[]]"`r`n") | % { $_.Trim() } | ? { $_.Length -gt 0 } 0..19 | % { #…
|
104
|
|
36 字
|
2 分钟
判断当前设备是否在线有网址
除了 ping baidu.com - http://www.gstatic.com/generate_204 288 - http://connectivitycheck.gstatic.com/generate_204 153 - http://captive.apple.com/ 146 - http://www.msftconnecttes…
|
107
|
|
27 字
|
1 分钟内
批量转换 epub 至 mobi 文件
# 下载 Calibre , 找到 ebook-convert.exe $app = ".\ebook-convert.exe" # ebook-convert.exe 路径 $root = ".\epub\" # 电子书路径 Get-ChildItem "$root\*.epub" | …
|
153
|
|
19 字
|
1 分钟内
pwsh 检测一批代理外网地址
检测代理是否正常 $ErrorActionPreference = "Stop" # 获取代理地址 function GetProxyIP([string]$proxyServer) { $ipInfoUrl = "https://ipinfo.io/ip" # $proxyServer = "ht…
|
104
|
|
37 字
|
2 分钟
windows mklink
# 命令 MKLINK [[/D] | [/H] | [/J]] Link Target /D 创建目录符号链接。默认为文件 符号链接。 /H 创建硬链接而非符号链接。 /J 创建目录联接。 Link 指定新的符号链接名称。 Target 指定新链接引用的路径 (相对或绝对)。 /J 链接目录,/J 好像简单一些,我一般用它 /D 链接目录,一般来…
|
93
|
|
20 字
|
1 分钟
powershell 容器磁盘空间相关
# 批量清理 $logDir = 'C:\Users\ContainerAdministrator\AppData\Roaming\Tencent\WXWork\Log' $tmpDir = 'C:\Users\ContainerAdministrator\AppData\Local\Temp\Tencent'…
|
139
|
|
262 字
|
9 分钟
windows 命令行设置代理服务器及防火墙
# 通过代理查询访问 ip Invoke-RestMethod -Uri 'http://api.ipify.org' -Proxy 'http://10.10.2.103:1001' # 注:不是所有程序都使用 winhttp, winget 似乎使用 winhttp # 设置代理 netsh winhtt…
|
140
|
|
49 字
|
3 分钟