tap hop lenh duoc chay theo thu tu.
ban luyen
PowerShell
lo trinh thuc hanh de hoc PowerShell tu con so 0
dinh nghia truoc
PowerShell la gi
PowerShell dung de viet chi dan chinh xac. O day ban hoc theo lo trinh thuc hanh de hoc PowerShell tu con so 0. Hay bat dau voi mot mo hinh: dau vao qua cac buoc roi thanh dau ra.
script.ps1chay pwsh script.ps1thoi quen hoc mot phan nho cua PowerShell, go vi du toi thieu roi chaygia tri la du lieu. bien la ten de giu du lieu.
mot viec nho co ten, nhan dau vao va tao ket qua.
PowerShell 7 chay code trong script.ps1.
doan code dau tien
dau ra chuong trinh
entry point output syntax Write-OutputWrite-Output 42
dau ra 42pha he ngon ngu
cay pha he PowerShell
xem PowerShell den tu dau, gan voi ngon ngu nao, va nen hoc gi tiep.
tu con so 0
Ngan hang cau hoi
Tim truoc khi luyen
Chon giai doan hoac tim trong ngan hang cua ngon ngu nay roi mo bai tap.
PowerShell cau 1
PowerShell cau 1. Chon mo ta phu hop nhat voi in mot gia tri.
PowerShell cau 2
PowerShell cau 2. Chon mo ta phu hop nhat voi dat ten cho gia tri.
PowerShell cau 3
PowerShell cau 3. Chon mo ta phu hop nhat voi ham tai su dung.
PowerShell cau 4
PowerShell cau 4. Chon mo ta phu hop nhat voi tap hop co ban.
PowerShell cau 5
PowerShell cau 5. Chon mo ta phu hop nhat voi in mot gia tri.
PowerShell cau 6
PowerShell cau 6. Chon mo ta phu hop nhat voi dat ten cho gia tri.
PowerShell cau 7
PowerShell cau 7. Chon mo ta phu hop nhat voi ham tai su dung.
PowerShell cau 8
PowerShell cau 8. Chon mo ta phu hop nhat voi tap hop co ban.
PowerShell cau 9
PowerShell cau 9. Chon mo ta phu hop nhat voi in mot gia tri.
PowerShell cau 10
PowerShell cau 10. Chon mo ta phu hop nhat voi dat ten cho gia tri.
PowerShell cau 11
PowerShell cau 11. Chon mo ta phu hop nhat voi ham tai su dung.
PowerShell cau 12
PowerShell cau 12. Chon mo ta phu hop nhat voi tap hop co ban.
PowerShell cau 13
PowerShell cau 13. Chon mo ta phu hop nhat voi in mot gia tri.
PowerShell cau 14
PowerShell cau 14. Chon mo ta phu hop nhat voi dat ten cho gia tri.
PowerShell cau 15
PowerShell cau 15. Chon mo ta phu hop nhat voi ham tai su dung.
PowerShell cau 16
PowerShell cau 16. Chon mo ta phu hop nhat voi tap hop co ban.
PowerShell cau 17
PowerShell cau 17. Chon mo ta phu hop nhat voi in mot gia tri.
PowerShell cau 18
PowerShell cau 18. Chon mo ta phu hop nhat voi dat ten cho gia tri.
trac nghiem
PowerShell cau 1
PowerShell cau 1. Chon mo ta phu hop nhat voi in mot gia tri.
Write-Output 42
tham khao
mau cho script.ps1
pwsh script.ps1entry point output syntax Write-Output
dau ra chuong trinh
Write-Output 42
- Run the smallest file first
- Print one known value
- Check the output before adding more code
variables assignment types $
gia tri va ten
$total = 42 Write-Output $total
- Give values readable names
- Keep one idea per line while learning
- Trace the value before changing it
function collection Array
ham va tap hop
function Add($a, $b) {
return $a + $b
}
$scores = @(40, 2)
Write-Output $scores.Count- Keep functions small
- Return useful values
- Use the common collection before reaching for frameworks