'chcp' 不是内部或外部命令,也不是可运行的程序或批处理文件。在 Windows PC 上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8142058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'chcp' is not recognized as an internal or external command, operable program or batch file. on a Windows PC
提问by Abundnce10
I am receiving the error message below in the command prompt when using the git init
command. I'm using a Windows PC running Windows 7.
使用该git init
命令时,我在命令提示符中收到以下错误消息。我正在使用运行 Windows 7 的 Windows PC。
C:\rails_projects\first_app>git init
'chcp' is not recognized as an internal or external command,
operable program or batch file.
Reinitialized existing Git repository in C:/rails_projects/first_app/.git/
'chcp' is not recognized as an internal or external command,
operable program or batch file.
I'm new to Ruby on Rails and I'm trying to create a repository for my Rails project. When I use a command such as rails new first_app
or rails server
I don't receive the message, only when I used the git init
command does it show up. Also, as you can see the command still functions correctly (i.e. Reinitialized existing Git repository in C:/rails_projects/first_app/.git/
), however, it's annoying to see the error message every time I make a command.
我是 Ruby on Rails 的新手,我正在尝试为我的 Rails 项目创建一个存储库。当我使用诸如rails new first_app
或 之类的命令时,rails server
我没有收到消息,只有当我使用该git init
命令时,它才会显示出来。此外,正如您所看到的,该命令仍然正常运行(即Reinitialized existing Git repository in C:/rails_projects/first_app/.git/
),但是,每次我执行命令时都看到错误消息很烦人。
Does anyone have any idea how to fix this problem?I found a link that told me I need to switch the console to Windows-1252 http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html#charsets_1252but that didn't work.
有谁知道如何解决这个问题?我找到了一个链接,告诉我我需要将控制台切换到 Windows-1252 http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html#charsets_1252但这没有工作。
I appreciate any help, thanks!
我感谢任何帮助,谢谢!
回答by manojlds
See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH
查看您的 PATH 环境变量是否设置正确。任何系统都应至少在 PATH 上具有以下内容
;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
Add the above if not there.
如果没有,请添加以上内容。
Once added, open a new cmd / bash and try:
添加后,打开一个新的 cmd / bash 并尝试:
where chcp
It should give the path.
它应该给出路径。
Then try with the git init
again
然后git init
再次尝试
回答by Lazy Badger
You have broken PATH (check with SET PATH), chcp is internal Windows-command, which can be found in $Windows\system32\ dir
您已经破坏了 PATH(检查 SET PATH),chcp 是 Windows 内部命令,可以在 $Windows\system32\ dir 中找到
回答by Gary Scott
I copied the file from windows/system32 into the Vmware CLI/bin directory which resolved it for me.
我将文件从 windows/system32 复制到 Vmware CLI/bin 目录中,该目录为我解决了这个问题。
回答by Andy
回答by Aman Khatri
Go to \RailsInstaller\Git\cmd then open the git (command prompt file) with a text editor or word pad (by right clicking the file and selecting edit) now there would be two lines which would look like
转到 \RailsInstaller\Git\cmd,然后使用文本编辑器或字板(通过右键单击文件并选择编辑)打开 git(命令提示符文件),现在将有两行看起来像
@chcp %cp_ansi% > nul < nul
and
和
@chcp %cp_oem% > nul < nul
delete both of them, and save the file . This should resolve the problem
删除它们,并保存文件。这应该可以解决问题