echo 2> .gitignore
此命令将std :: cerr(在本例中为空输出)重定向到.gitignore文件中.结果文件有ANSI编码,但我需要utf-8.我可以为>指出必要的编码(utf-8)吗?操作?
使用内置实用程序执行此操作的唯一方法是调用powershell:
powershell -c "[io.file]::WriteAllText('.gitignore','',[System.Text.Encoding]::UTF8)"