Sunday 16 August 2015

List The Items in a directory

If we are in our cmd.exe, We use the command 'dir', which lists the contents inside a directory.

How PowerShell do this ?

Open windows PowerShell and type 'dir' .


PS C:\inetpub> dir


    Directory: C:\inetpub


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        10/3/2014   4:19 PM                custerr
d-----        1/12/2015   2:41 PM                ftproot
d-----        6/27/2015   5:44 PM                history
d-----        1/12/2015  12:48 PM                logs
d-----        1/12/2015   2:48 PM                temp
d-----        1/12/2015   2:48 PM                wwwroot


Woow... Its works here too :)

yes,It'll and the unix command 'ls' too works.
These are Aliases for the powershell cmdlet 'Get-Childitem' which is the original PowerShell way of listing items in a directory.

PS C:\inetpub> Get-ChildItem


    Directory: C:\inetpub


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        10/3/2014   4:19 PM                custerr
d-----        1/12/2015   2:41 PM                ftproot
d-----        6/27/2015   5:44 PM                history
d-----        1/12/2015  12:48 PM                logs
d-----        1/12/2015   2:48 PM                temp
d-----        1/12/2015   2:48 PM                wwwroot

Then by using 'ls'




No comments:

Post a Comment