Skip to main content
added 2 characters in body
Source Link
LPChip
  • 62.2k
  • 10
  • 101
  • 146

Command prompt is indeed different to PowerShell.

dir is an internal command of Command Prompt and Powershell does not have this function.

Powershell has the cmdlet: get-childitem, which also gets all files in a folder, but has significant differences compared to cmd's dir function.

To make people get started quickly in powershell, they added the alias dir, ls and gci to the cmdlet get-childitem. This means that, even though you can type in dirdir in powershell, none of the parameters work the way they work in cmd. For example, in cmd, you can type dir /s, in powershell, you would type get-childitem -recurse. Because dir is an alias for get-childitem, you can also type dir -recurse.

It is true that all normal commands that you can run in cmd (calling .exe files) work natively in PowerShell. Dir however is not a program with .exe extension, but an internal function of cmd.

Command prompt is indeed different to PowerShell.

dir is an internal command of Command Prompt and Powershell does not have this function.

Powershell has the cmdlet: get-childitem, which also gets all files in a folder, but has significant differences compared to cmd's dir function.

To make people get started quickly in powershell, they added the alias dir, ls and gci to the cmdlet get-childitem. This means that, even though you can type in dir in powershell, none of the parameters work the way they work in cmd. For example, in cmd, you can type dir /s, in powershell, you would type get-childitem -recurse. Because dir is an alias for get-childitem, you can also type dir -recurse.

Command prompt is indeed different to PowerShell.

dir is an internal command of Command Prompt and Powershell does not have this function.

Powershell has the cmdlet: get-childitem, which also gets all files in a folder, but has significant differences compared to cmd's dir function.

To make people get started quickly in powershell, they added the alias dir, ls and gci to the cmdlet get-childitem. This means that, even though you can type in dir in powershell, none of the parameters work the way they work in cmd. For example, in cmd, you can type dir /s, in powershell, you would type get-childitem -recurse. Because dir is an alias for get-childitem, you can also type dir -recurse.

It is true that all normal commands that you can run in cmd (calling .exe files) work natively in PowerShell. Dir however is not a program with .exe extension, but an internal function of cmd.

Source Link
LPChip
  • 62.2k
  • 10
  • 101
  • 146

Command prompt is indeed different to PowerShell.

dir is an internal command of Command Prompt and Powershell does not have this function.

Powershell has the cmdlet: get-childitem, which also gets all files in a folder, but has significant differences compared to cmd's dir function.

To make people get started quickly in powershell, they added the alias dir, ls and gci to the cmdlet get-childitem. This means that, even though you can type in dir in powershell, none of the parameters work the way they work in cmd. For example, in cmd, you can type dir /s, in powershell, you would type get-childitem -recurse. Because dir is an alias for get-childitem, you can also type dir -recurse.