Commit bcd88e01 authored by 马旭烽's avatar 马旭烽

feat: ps1 学习

parent 7caf018d
# #!/bin/powershell
echo "Welcome To Here"
$NAME = 'FIRE_MAN_34'
$BAG = 'BAG';
echo $NAME
echo "路径参数 $0"
\ No newline at end of file
$paramters = @{
# 按键绑定
Key = 'Alt+w'
# 描述
BriefDescription = '保存历史'
# 长描述
LoginDescription = '保存当前行到命令行里是但不执行它'
# 脚本块
ScriptBlock = {
param($key, $arg) # 当前示例忽略具体参数
# GetBufferState 为我们提供了命令行(带有光标位置)
$line = $null
$cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor);
# AddToHistory 保存历史记录中的行,但不执行它。
[Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($line)
# 回复命令行就像按下退出键一样
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
}
}
Set-PSReadLineKeyHandler @paramters;
\ No newline at end of file
# mkdir temp & echo "xx" >> ./temp.txt & rm ./temp.txt & rmdir ./temp & rm ./temp.txt 并行
mkdir temp
echo "xx" >> ./temp.txt
rmdir ./temp
rm ./temp.txt
1. 入门命令
```powershell
Get-Help Name 查找命令帮助
Get-Command 提供所有命令通常配合管道 | Select-Object 进行筛选
Get-Process 获取进程 | Where-Object 配合进行筛选
```
\ No newline at end of file
Verb AliasPrefix Group Description
---- ----------- ----- -----------
Add a Common Adds a resource to a container, or attaches an item to another item
Clear cl Common Removes all the resources from a container but does not delete the container
Close cs Common Changes the state of a resource to make it inaccessible, unavailable, or unusable
Copy cp Common Copies a resource to another name or to another container
Enter et Common Specifies an action that allows the user to move into a resource
Exit ex Common Sets the current environment or context to the most recently used context
Find fd Common Looks for an object in a container that is unknown, implied, optional, or specif…
Format f Common Arranges objects in a specified form or layout
Get g Common Specifies an action that retrieves a resource
Hide h Common Makes a resource undetectable
Join j Common Combines resources into one resource
Lock lk Common Secures a resource
Move m Common Moves a resource from one location to another
New n Common Creates a resource
Open op Common Changes the state of a resource to make it accessible, available, or usable
Optimize om Common Increases the effectiveness of a resource
Push pu Common Adds an item to the top of a stack
Pop pop Common Removes an item from the top of a stack
Redo re Common Resets a resource to the state that was undone
Remove r Common Deletes a resource from a container
Rename rn Common Changes the name of a resource
Reset rs Common Sets a resource back to its original state
Resize rz Common Changes the size of a resource
Search sr Common Creates a reference to a resource in a container
Select sc Common Locates a resource in a container
Set s Common Replaces data on an existing resource or creates a resource that contains some d…
Show sh Common Makes a resource visible to the user
Skip sk Common Bypasses one or more resources or points in a sequence
Split sl Common Separates parts of a resource
Step st Common Moves to the next point or resource in a sequence
Switch sw Common Specifies an action that alternates between two resources, such as to change bet…
Undo un Common Sets a resource to its previous state
Unlock uk Common Releases a resource that was locked
Watch wc Common Continually inspects or monitors a resource for changes
Connect cc Communications Creates a link between a source and a destination
Disconnect dc Communications Breaks the link between a source and a destination
Read rd Communications Acquires information from a source
Receive rc Communications Accepts information sent from a source
Send sd Communications Delivers information to a destination
Write wr Communications Adds information to a target
Backup ba Data Stores data by replicating it
Checkpoint ch Data Creates a snapshot of the current state of the data or of its configuration
Compare cr Data Evaluates the data from one resource against the data from another resource
Compress cm Data Compacts the data of a resource
Convert cv Data Changes the data from one representation to another when the cmdlet supports bid…
ConvertFrom cf Data Converts one primary type of input (the cmdlet noun indicates the input) to one …
ConvertTo ct Data Converts from one or more types of input to a primary output type (the cmdlet no…
Dismount dm Data Detaches a named entity from a location
Edit ed Data Modifies existing data by adding or removing content
Expand en Data Restores the data of a resource that has been compressed to its original state
Export ep Data Encapsulates the primary input into a persistent data store, such as a file, or …
Group gp Data Arranges or associates one or more resources
Import ip Data Creates a resource from data that is stored in a persistent data store (such as …
Initialize in Data Prepares a resource for use, and sets it to a default state
Limit l Data Applies constraints to a resource
Merge mg Data Creates a single resource from multiple resources
Mount mt Data Attaches a named entity to a location
Out o Data Sends data out of the environment
Publish pb Data Makes a resource available to others
Restore rr Data Sets a resource to a predefined state, such as a state set by Checkpoint
Save sv Data Preserves data to avoid loss
Sync sy Data Assures that two or more resources are in the same state
Unpublish ub Data Makes a resource unavailable to others
Update ud Data Brings a resource up-to-date to maintain its state, accuracy, conformance, or co…
Debug db Diagnostic Examines a resource to diagnose operational problems
Measure ms Diagnostic Identifies resources that are consumed by a specified operation, or retrieves st…
Ping pi Diagnostic Use the Test verb
Repair rp Diagnostic Restores a resource to a usable condition
Resolve rv Diagnostic Maps a shorthand representation of a resource to a more complete representation
Test t Diagnostic Verifies the operation or consistency of a resource
Trace tr Diagnostic Tracks the activities of a resource
Approve ap Lifecycle Confirms or agrees to the status of a resource or process
Assert as Lifecycle Affirms the state of a resource
Build bd Lifecycle Creates an artifact (usually a binary or document) out of some set of input file…
Complete cmp Lifecycle Concludes an operation
Confirm cn Lifecycle Acknowledges, verifies, or validates the state of a resource or process
Deny dn Lifecycle Refuses, objects, blocks, or opposes the state of a resource or process
Deploy dp Lifecycle Sends an application, website, or solution to a remote target[s] in such a way t…
Disable d Lifecycle Configures a resource to an unavailable or inactive state
Enable e Lifecycle Configures a resource to an available or active state
Install is Lifecycle Places a resource in a location, and optionally initializes it
Invoke i Lifecycle Performs an action, such as running a command or a method
Register rg Lifecycle Creates an entry for a resource in a repository such as a database
Request rq Lifecycle Asks for a resource or asks for permissions
Restart rt Lifecycle Stops an operation and then starts it again
Resume ru Lifecycle Starts an operation that has been suspended
Start sa Lifecycle Initiates an operation
Stop sp Lifecycle Discontinues an activity
Submit sb Lifecycle Presents a resource for approval
Suspend ss Lifecycle Pauses an activity
Uninstall us Lifecycle Removes a resource from an indicated location
Unregister ur Lifecycle Removes the entry for a resource from a repository
Wait w Lifecycle Pauses an operation until a specified event occurs
Use u Other Uses or includes a resource to do something
Block bl Security Restricts access to a resource
Grant gr Security Allows access to a resource
Protect pt Security Safeguards a resource from attack or loss
Revoke rk Security Specifies an action that does not allow access to a resource
Unblock ul Security Removes restrictions to a resource
Unprotect up Security Removes safeguards from a resource that were added to prevent it from attack or …
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment