-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcmdlets.ps1
49 lines (38 loc) · 1.65 KB
/
cmdlets.ps1
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
44
45
46
47
48
# =====================================
# Cmdlets
# =====================================
# Goal: The goal of this file is to
# illustrate some common cmdlets
# in PowerShell.
# =====================================
# =====================================
# PowerShell equivalent of ping
# =====================================
Test-Connection -TargetName '127.0.0.1'
# Example result:
# Ping Source Address Latency BufferSize Status
# (ms) (B)
# ---- ------ ------- ------- ---------- ------
# 1 Carolines-MacBo… 127.0.0.1 0 32 Success
# 2 Carolines-MacBo… 127.0.0.1 0 32 Success
# 3 Carolines-MacBo… 127.0.0.1 0 32 Success
# 4 Carolines-MacBo… 127.0.0.1 0 32 Success
# =====================================
# PowerShell equivalent of ls or dir
# =====================================
Get-ChildItem ./
# Example result:
# Directory: C:\Users\caroline.chiari\temp
#
# Mode LastWriteTime Length Name
# ---- ------------- ------ ----
# -a---- 7/6/2021 7:51 PM 6 file1.txt
# -a---- 7/6/2021 7:51 PM 6 file2.txt
# -a---- 7/6/2021 7:51 PM 6 file3.txt
# -a---- 7/6/2021 7:51 PM 6 file4.txt
# =====================================
# PowerShell equivalent of echo
# =====================================
Write-Host "This is a test"
# Example result:
# This is a test