PowerShell (2): PowerShell and Cmd command lines (1)

Source: Internet
Author: User

 PowerShell commands

Windows PowerShell is a command line shell program and script environment that allows command line users and script writers to take advantage of the powerful functions of. NET Framework. It introduces many useful new concepts to further expand your knowledge and scripts created in the Windows Command Prompt and Windows Script Host environment.

Start PowerShell and enter several common Cmd commands.

PS D:\Projects\Practise\PowerShell> dir    Directory: D:\Projects\Practise\PowerShellMode                LastWriteTime     Length Name----                -------------     ------ ----d----         1/23/2013  12:35 PM            d1d----         1/23/2013  12:35 PM            d2-a---         1/21/2013   8:38 PM      36314 alias.txt-a---         1/21/2013   8:32 PM     241530 cmdlets.txt

Or

PS D:\Projects\Practise\PowerShell> cd ..PS D:\Projects\Practise>

The results are similar to our expectation. However, can we say that PowerShell is the enhanced version of command line? Try the following command again:

PS D:\Projects\Practise\PowerShell> dir /addir : Cannot find path 'D:\ad' because it does not exist.

...

This is far from our expectation. In Cmd, it should output information about the subfolders in the current position, but here, it does not seem to understand our parameters. The following command is the same:

PS D:\Projects\Practise\PowerShell> fc .\alias.txt .\cmdlets.txtFormat-Custom : A positional parameter cannot be found that accepts argument '.\cmdlets.txt'.

...

I originally wanted to call the fc command to compare two files, but it understood it as Format-Custom. What's the problem? Here we can answer the first two questions: PowerShell cannot execute all commands of the Cmd command line. To be exact, PowerShell cannot execute any Cmd command, at least not directly. This is because PowerShell is not a new or enhanced version of Cmd, but some of its commands have similar functions as Cmd commands.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.