-
Notifications
You must be signed in to change notification settings - Fork 0
/
Powershell CLI
43 lines (30 loc) · 970 Bytes
/
Powershell CLI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
List all Powershell commands:
Get-Command
List help for specified Powershell command:
Get-Help "Powershell command"
List Drives:
Get-PSDrive
List all childitems in c:/:
Get-ChildItem c:/
Rename a file:
Rename-Item -Path “OldFile” -NewName “NewFile”
Copy from Source to Destination.
Get-ChildItem "Source1" -Recursive | Copy-Item -Destination "Destination1"
Move from Source to Destination.
Get-ChildItem "Source1" -Recursive | Move-Item -Destination "Destination1"
Delete a Directory:
Remove-Item -Path "Source1"
Delete all files in a directory:
Get-ChildItem -Path "Source1" -File | Remove-Item
Remove all ".log" items:
Remove-Item -Path "Source1" -Recursive -Include "*.log"
Export Options:
Export-Csv
-| Export-Csv "Filepath""Filename.csv" -NoTypeInformation
Outfile
-| Out-File "Filepath""Filename.txt"
List processes:
--------------------
-Get-Process
-Get-Process -Id "Process ID" | Stop-Process
-Get-Process -Id "Process ID" | Start-Process