【问题标题】:Which Windows Shell command will print a file content on the standard output (like cat in Linux)?哪个 Windows Shell 命令将在标准输出上打印文件内容(如 Linux 中的 cat)?
【发布时间】:2012-06-29 10:12:34
【问题描述】:

哪个 Windows Shell 命令将在标准输出上打印文件内容(如 Linux 中的 cat)?

使用 Google、Stackoverflow 等,我只是找不到解决方案,但我敢肯定,有一个简单的解决方案。

【问题讨论】:

    标签: windows shell cat


    【解决方案1】:

    命令是:type <filename>

    然而,如果你想对你的 Windows shell 进行 Unix-fy,那么大多数 Unix 风格的命令都有Win32 ports

    【讨论】:

      【解决方案2】:

      这有点骇人听闻,但我做到了...

      下载适用于 Windows 的 Git Bash。这对于在 Windows 上打开 linux 风格的命令提示符非常有用。

      然后,创建一个新的 git 存储库并将您希望显示的文件添加到 git 存储库。然后你就可以 git 显示了。

      假设您有想要显示的 testFile.txt,它位于“C:\Users\username\Desktop\FolderWhereFileIs”

      cd "/c/Users/username/Desktop/FolderWhereFileIs/"
      git add -A
      git commit -m "Commit with all files"
      git show testFile.txt
      

      【讨论】:

        猜你喜欢
        • 2021-10-08
        • 2013-09-23
        • 1970-01-01
        • 1970-01-01
        • 2021-04-29
        • 2013-10-08
        • 1970-01-01
        • 2011-11-14
        • 1970-01-01
        相关资源
        最近更新 更多