Update cheatsheets

This commit is contained in:
ivuorinen
2025-10-23 00:19:46 +00:00
parent 0cc7cfe867
commit 058ce19122
64 changed files with 437 additions and 86 deletions

View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, windows]
source: https://github.com/tldr-pages/tldr.git
---
# Compress-Archive
> A cmdlet in PowerShell is used to create compressed (zipped) archive files.
> More information: <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive>.
- Compress a single file:
`Compress-Archive -Path {{path o ile.txt}} -DestinationPath {{path o ile.zip}}`
- Compress multiple files:
`Compress-Archive -Path {{path o ile1, path o ile2, ...}} -DestinationPath {{path o iles.zip}}`
- Compress a directory:
`Compress-Archive -Path {{path o\directory}} -DestinationPath {{path o\directory.zip}}`
- Update an existing archive:
`Compress-Archive -Path {{path o ile}} -DestinationPath {{path o\directory.zip}} -Update`
- Set compression level:
`Compress-Archive -Path {{path o\directory}} -DestinationPath {{path o\directory.zip}} -CompressionLevel {{Optimal|Fastest|NoCompression}}`

View File

@@ -0,0 +1,21 @@
---
syntax: markdown
tags: [tldr, windows]
source: https://github.com/tldr-pages/tldr.git
---
# Expand-Archive
> A cmdlet in PowerShell is used to extract files from a compressed archive.
> More information: <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/expand-archive>.
- Extract a ZIP file to a folder:
`Expand-Archive -Path {{path oxample.zip}} -DestinationPath {{path oxtracted_files}}`
- Overwrite existing files:
`Expand-Archive -Path {{path oxample.zip}} -DestinationPath {{path oxtracted_files}} -Force`
- Preview without extracting:
`Expand-Archive -Path {{path oxample.zip}} -DestinationPath {{path oxtracted_files}} -WhatIf`

View File

@@ -17,6 +17,6 @@ source: https://github.com/tldr-pages/tldr.git
`Get-History -Id {{id}}`
- Display the last N commands:
- Display the last `n` commands:
`Get-History -Count {{10}}`
`Get-History -Count {{n}}`

View File

@@ -23,7 +23,7 @@ source: https://github.com/tldr-pages/tldr.git
- Send data in JSON format, specifying the appropriate content-type header:
`Invoke-WebRequest -Body {{'{"name":"bob"}'}} -ContentType 'application/json' {{http://example.com/users/1234}}`
`Invoke-WebRequest -Body '{{{"name":"bob"}}}' -ContentType 'application/json' {{http://example.com/users/1234}}`
- Pass a username and password for server authentication:

View File

@@ -10,16 +10,24 @@ source: https://github.com/tldr-pages/tldr.git
- Show the status of a service (no service name will list all services):
`sc.exe query {{service_name}}`
`sc query {{service_name}}`
- Start a service asynchronously:
`sc.exe create {{service_name}} binpath= {{path o\service_binary_file}}`
`sc start {{service_name}}`
- Stop a service asynchronously:
`sc.exe delete {{service_name}}`
`sc stop {{service_name}}`
- Create a service:
`sc create {{service_name}} binpath= {{path o\service_binary_file}}`
- Delete a service:
`sc delete {{service_name}}`
- Set the type of a service:
`sc.exe config {{service_name}} type= {{service_type}}`
`sc config {{service_name}} type= {{service_type}}`