windows “编辑”不是 cmd.exe 中的有效命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15289951/
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
"edit" not a valid command in cmd.exe?
提问by J E Carter II
I'm trying to create a .cfg file for bcc32 compiler and I'm following the instructions. I have installed correctly and placed an environment path as instructed but when I type "edit bcc32.cfg" into the command prompt it says that edit isn't a valid command? What am I supposed to do?
我正在尝试为 bcc32 编译器创建一个 .cfg 文件,我正在按照说明进行操作。我已经正确安装并按照说明放置了环境路径,但是当我在命令提示符中键入“edit bcc32.cfg”时,它说编辑不是有效命令?我应该做些什么?
回答by J E Carter II
You could also create a .bat file, edit.bat, to replace the 16-bit edit program (removed because x64 windows flavors won't run it) which would launch your favorite editor.
您还可以创建一个 .bat 文件edit.bat来替换 16 位编辑程序(已删除,因为 x64 windows 版本不会运行它),它将启动您最喜欢的编辑器。
@echo off
notepad %1
@echo on
This is what I wound up doing as a simple patch so I could carry on the way I always had for the most part. Just type:
这就是我作为一个简单的补丁最终做的事情,所以我可以继续我在大多数情况下的方式。只需输入:
edit myfile.ext
in the command prompt to use it.
在命令提示符下使用它。
Note: notepad is not my favorite editor - this is just an example that will work with stock windows.
注意:记事本不是我最喜欢的编辑器 - 这只是一个适用于股票窗口的例子。
Note 2: @echo off and @echo on are shown for clarity. You may also shorten this by omitting the echo statements and simply placing the @ before the command to be silenced.
注 2:为清楚起见,显示了 @echo off 和 @echo on。您也可以通过省略 echo 语句并简单地将 @ 放在要静音的命令之前来缩短此时间。
@notepad %1
回答by user3610032
I just use notepad (since they took out the edit command) from the command window like so:
我只是在命令窗口中使用记事本(因为他们取出了编辑命令),如下所示:
C:\Borland\BCC55\bin> notepad bcc32.cfg
The file will open in notepad for editing. When you've finished editing the file, save it and you're done.
该文件将在记事本中打开以进行编辑。完成编辑文件后,保存它并完成。
回答by Todd B
I have found this works for seeing in-window text of a complete file, on a 64bit machine. Once your path is set in cmd prompt, type the word type... followed by "filename" do you see how I used the quotes around the filename only!
我发现这适用于在 64 位机器上查看完整文件的窗口内文本。在 cmd 提示符下设置路径后,键入单词 type... 后跟“文件名”,您是否看到我仅在文件名周围使用引号!
type "filename"
You type it just like this (changing filename for your files name) and you will be able to see the entire file text in the cmd window. Not sure how to edit from here on but maybe someone can figure it out from here and tell me.
您像这样输入它(更改文件名的文件名),您将能够在 cmd 窗口中看到整个文件文本。不知道如何从这里开始编辑,但也许有人可以从这里弄清楚并告诉我。
回答by simplyray
Assuming you're using Windows 7 (where edit.exe
and edlin.exe
have been removed):
Use powershell.exe
instead of cmd
- thereby edit
will be available via command line.
假设您使用的是 Windows 7(其中edit.exe
和edlin.exe
已被删除):使用powershell.exe
代替cmd
- 因此edit
将可通过命令行使用。
Take a look at: http://en.wikipedia.org/wiki/Windows_PowerShell
回答by Wisdom Oparaocha
simple answer.... if your using an old version of windows (xp e.t.c...) you would be able to use edit but since your using new version of windows, Microsoft has updated and removed the commands that they think are not relevant e.g.. (msg, edit) depending if its a bit32 bit64 or bit82...
简单的答案....如果您使用旧版本的 Windows(xp 等),您将能够使用 edit 但由于您使用新版本的 Windows,Microsoft 已更新并删除了他们认为不相关的命令,例如. (msg, edit) 取决于它是 bit32 bit64 还是 bit82 ...