Skip to content

Instantly share code, notes, and snippets.

View CN-CODEGOD's full-sized avatar
😏
share my thought

CN-CODEGOD

😏
share my thought
View GitHub Profile
import-xml 的类存储在整个系统的类,直接在powershell启动时import
还有一种类是环境类。这种类只在程序/模组里启用
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ InitialDirectory = [Environment]::GetFolderPath('Desktop') }
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
#选择路径
InitialDirectory = [Environment]::GetFolderPath('Desktop')
#filter 后缀
Filter = 'Documents (*.docx)|*.docx|SpreadSheet (*.xlsx)|*.xlsx'
}
$Null = $FileBrowser.ShowDialog()
@CN-CODEGOD
CN-CODEGOD / ps1
Created October 10, 2025 19:06
powershell key read
for ($i = 0; $i -eq 0) {
#鎸塃nter 鑾峰彇浣犵殑鍏綉IP...
Write-Host "鎸塃nter 鑾峰彇浣犵殑鍏綉IP..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host "姝e湪鑾峰彇鍏綉IP..."
$ip = (Invoke-WebRequest -Uri "http://ipinfo.io/ip").Content
Write-Host "浣犵殑鍏綉IP鏄? $ip"
}