Powershell:
cmdlets:
Get-NetIPAddress
Get-Help
Get-PSdrive
In any registry, children are the subkeys of the current key. To get the required details, you can use the following command.
Get-ChildItem
Run this command to list all the children recursively of the current PSdrive, folder, or registry key.
Get-ChildItem -recurse
Use this command To include the hidden folders (directories).
Get-ChildItem -rec -force
(Get-ChildItem).name or Get-ChildItem -name
Use this command to get the number of entries in the collection of objects returned by the Get-Children.
(Get-ChildItem).count
PSdrives:
The prompt character will change to the “ENV:>”. Set-Location env by running the following command:Set-Location env-
Switching to env-
Env:\> Get-Childitem
Env:\> Get-Childitem userprofile
Env:\> Set-Location alias:
Alias:\> Get-Childitem
Alias:\> Set-Location C:\
C:\Users\user_name>$alias:ls
Pipelines:
Get-ChildItem *.txt | Where-Object length -lt 1000 | Sort-Object length
Easily sets the value of the ‘lastwritetime.year’ property to the present date and time without affecting the file’s content.
(Get-Item /Users/praashibansal/Desktop).lastwritetime.year
(Get-ChildItem data.txt.rtf -name).name # -> null
"data.txt.rtf" | Rename-Item -NewName "data_new.txt.rtf"
Get-ChildItem data.txt | Rename-Item -new {$_.name}
If the piped object $_ doesn't have the member property (name), you will receive an error, as parameter $_.name is null
Get-ChildItem data.txt.rtf -name | Rename-Item -new {$_.name}
Displays the list of the names of all the files that are present in the current folder sorted in alphabetical order.
Get-ChildItem | Select-Object basename | Sort-Object *
Move-Item *.txt subdirectory
Get-ChildItem *.txt | Move-Item ..\
Alias:
Add-Content
Get-Content
Set-Location
Clear-Host
Remove-Item
Get-ChildItem -Path .\
Write-Output
Foreach-Object
Format-Table
Format-List
Get-Alias
Get-Command
Get-Member
Get-ItemProperty .\data.txt | Format-List
Get-ItemPropertyValue -Path '.\data.txt' -Name LastWriteTime
Get-Variable m*
New-Item -Path .\ -Name "testfile1.txt" -ItemType "file" -Value "This is a text string."
Get-Process
Get-Location
Rename-Item -Path “old_name” -NewName “new_name”
Remove-Item .\testfile1.txt
Remove-Variable
Start-Sleep