This file contains hidden or 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
| 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" | |
| } |
This file contains hidden or 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
| 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() |
This file contains hidden or 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
| import-xml 的类存储在整个系统的类,直接在powershell启动时import | |
| 还有一种类是环境类。这种类只在程序/模组里启用 |
This file contains hidden or 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
| pip install pyinstaller | |
| pyinstaller --onefile main.py |
This file contains hidden or 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
| # Python 3 | |
| python3 -m http.server 8000 |
This file contains hidden or 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
| 1.sudo apt install python3.12-venv | |
| 2.python3 -m venv /var/www/server/ |
This file contains hidden or 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
| 利用flask简单做一个API 网页 | |
| 1. | |
| pip install flask | |
| 2. | |
| from flask import Flask | |
| import subprocess | |
| app = Flask(__name__) |
This file contains hidden or 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
| npm config set proxy=http://127.0.0.1:7890 |
This file contains hidden or 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
| # Define the types to export with type accelerators. | |
| $ExportableTypes =@( | |
| [DefinedTypeName] | |
| ) | |
| # Get the internal TypeAccelerators class to use its static methods. | |
| $TypeAcceleratorsClass = [psobject].Assembly.GetType( | |
| 'System.Management.Automation.TypeAccelerators' | |
| ) | |
| # Ensure none of the types would clobber an existing type accelerator. | |
| # If a type accelerator with the same name exists, throw an exception. |
This file contains hidden or 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
| Description | |
| The Set-PSReadLineKeyHandler cmdlet customizes the result when a key or sequence of keys is pressed. With user-defined key bindings, you can do almost anything that's possible from within a PowerShell script. | |
| Examples | |
| Example 1: Bind the arrow key to a function | |
| This command binds the up arrow key to the HistorySearchBackward function. This function searches command history for command lines that start with the current contents of the command line. | |
| PowerShell | |
| Copy |
NewerOlder