![项目中用到富文本编辑](https://i-blog.csdnimg.cn/blog_migrate/9589ae573a93c3382c5270270c8c420b.png)
项目中用到富文本编辑
![](https://i-blog.csdnimg.cn/blog_migrate/65c6fd2490bf6bf7cbe5de9ac09e4582.png)
Notepad is a Windows staple that hasn’t really changed in years. It’s fine as a basic text editor, but if you’d like to replace it with something a bit more powerful, then read on.
记事本是Windows的主要组成部分,多年来并没有真正改变。 可以作为基本的文本编辑器来使用,但是如果您想用功能更强大的替代它,请继续阅读。
Text editors are great. They’re fast and easy to use for simple things like taking fast notes, keeping a dated log or journal file, or editing the odd configuration or even HTML file. Programmers and developers use them as one of their basic editing tools. Notepad has been the standard text editor included with Windows for many years. The problem is, as text editors go, Notepad is really basic. There are plenty of alternatives out there that add things like tabs, highlighted syntax, autocompletion, bookmarks, and customizable interfaces. And most of them are just as fast and easy to use as Notepad.
文本编辑器很棒。 它们可以快速简便地用于简单的事情,例如做快速笔记, 保留带日期的日志或日志文件 ,或编辑奇数配置甚至HTML文件。 程序员和开发人员将它们用作其基本的编辑工具之一。 记事本多年来一直是Windows附带的标准文本编辑器。 问题是,随着文本编辑器的发展,记事本真的很基础。 有很多替代方法可以添加选项卡,突出显示的语法,自动完成,书签和可自定义的界面。 而且它们大多数都和记事本一样快速且易于使用。
Sure, you could always just install one and use it like any other app, but we’re going to show you how actually replace Notepad so that your preferred text editor becomes the default tool when you—or any app—opens text files or calls on Notepad from anywhere in the Windows interface.
当然,您总是可以只安装一个并像其他任何应用程序一样使用它,但是我们将向您展示如何实际替换记事本,以便当您(或任何应用程序) 打开文本文件或调用时,首选的文本编辑器成为默认工具。在Windows界面中任何位置的记事本上。
第一步:选择一个替换文本编辑器 (Step One: Choose a Replacement Text Editor)
There are a ton of great Notepad replacements out there. Notepad2 and Metapad are both freeware favorites that work with the technique we’re describing in this article. If you use an editor professionally for development and don’t mind paying for extra features, you might also want to check out Sublime Text ($70) and UltraEdit ($99.95). The best editor for you will depend on what you need a text editor to do, so we encourage you to try them out and see what strikes your fancy before settling on a replacement. Once you do settle on a replacement, you’re ready to move on with the rest of these instructions.
那里有大量的记事本替代品。 Notepad2和Metapad都是与我们在本文中介绍的技术配合使用的免费软件的最爱。 如果您专业地使用编辑器进行开发,并且不介意支付额外的功能,则可能还需要查看Sublime Text (70美元)和UltraEdit (99.95美元)。 最适合您的编辑器将取决于您需要文本编辑器执行的操作,因此我们建议您尝试一下它们,看看在满足您的需求之前会发现什么让您看中。 确定要更换后,您就可以继续执行这些说明中的其余部分。
![](https://i-blog.csdnimg.cn/blog_migrate/9ce38b93ebce6201f78f2642a2ccea17.png)
We’re using Notepad2 as our example in this article. With its relatively minimalist interface, line numbers, and highlighted syntax, it’s long been a favorite around here.
在本文中,我们以Notepad2为例。 凭借其相对简约的界面,行号和突出显示的语法,长期以来一直是此处的首选。
第二步:确保新的文本编辑器可以替代 (Step Two: Make Sure the New Text Editor Will Work as a Replacement)
The technique we’re using in this article is to actually replace the “notepad.exe” file in the Windows system folders with a copy of the EXE file for our chosen replacement editor. For this reason, the text editor replacement you choose will only work if its executable file can run outside its own folder. This usually isn’t the case with apps you have to install, so it’s best to look for an app that you can download as a self-contained ZIP package instead. Portable apps are ideal candidates.
我们在本文中使用的技术实际上是将Windows系统文件夹中的“ notepad.exe”文件替换为EXE文件的副本,以供我们选择的替换编辑器使用。 因此,您选择的文本编辑器替换仅在其可执行文件可以在其自己的文件夹之外运行时才起作用。 您必须安装的应用程序通常不是这种情况,因此最好寻找可以作为独立的ZIP软件包下载的应用程序。 便携式应用程序是理想的选择。
We’ve already tested both Metapad and Notepad2, and both will work. If you’re using a different app, it’s easy enough to test whether it will work. Start by downloading the app you want to test and installing it if it’s an installable app. Next, you’ll need to find the app’s folder. If it’s a portable app, that’s just the folder you extracted. If it’s an installed app, you’ll find it in either your “Program Files” or “Program Files (x86)” folders.
我们已经测试了Metapad和Notepad2,并且都可以使用。 如果您使用的是其他应用程序,则很容易测试它是否可以正常工作。 首先下载要测试的应用程序,然后将其安装(如果它是可安装的应用程序)。 接下来,您需要找到应用程序的文件夹。 如果它是便携式应用程序,那就只是您提取的文件夹。 如果它是已安装的应用程序,则可以在“程序文件”或“程序文件(x86)”文件夹中找到它。
![](https://i-blog.csdnimg.cn/blog_migrate/825f6ec146c19abafb061af309b93b4a.png)
When you’ve found the app’s folder, you should see just one file inside with an EXE extension.
找到应用程序的文件夹后,内部应该只看到一个带有EXE扩展名的文件。
![](https://i-blog.csdnimg.cn/blog_migrate/a48e83c5ef936dadfa5e3f258a5c360c.png)
Copy that executable file by selecting it and pressing Ctrl+C on your keyboard. Go to your desktop and paste the file there by hitting Ctrl+V. The idea here is to get the executable file somewhere all by itself, without the other stuff in its folder. Now, double-click that copied file and see if the text editor can run. If it does, you’re good to go. If it doesn’t, then it won’t work with the techniques in this article.
通过选择可执行文件并在键盘上按Ctrl + C来复制该可执行文件。 转到桌面,然后按Ctrl + V将文件粘贴到该桌面。 这里的想法是单独将可执行文件放在某个地方,而文件夹中没有其他内容。 现在,双击复制的文件,然后查看文本编辑器是否可以运行。 如果是这样,那您就很好。 如果没有,那么它将无法使用本文中的技术。
NOTE: You may have noticed that one of the long-standing favorite text editors—Notepad++—isn’t on our list. While it used to work with the techniques we’re discussing in this article, it’s gotten to be sophisticated enough an app that even the portable version can no longer run outside its own folder.
注意:您可能已经注意到,长期以来最喜欢的文本编辑器之一(记事本++)不在我们的列表中。 尽管它曾经与我们在本文中讨论的技术配合使用,但它已经变得足够复杂,一个应用程序甚至是便携式版本也无法在其自己的文件夹之外运行。
第三步:备份记事本 (Step Three: Back Up Notepad)
Since we’re going to be replacing the Notepad executable file, you’ll first want to back that file up. You likely won’t want to switch back to Notepad after getting used to a replacement, but you never know. Believe it or not, the “notepad.exe” file exists in multiple locations on your PC, and you’ll be replacing all of them. You can find the executables at the following locations:
由于我们将要替换记事本可执行文件,因此您首先需要备份该文件。 在习惯了替换之后,您可能不想切换回记事本,但您永远不会知道。 信不信由你,“ notepad.exe”文件存在于您的PC上的多个位置,您将替换所有这些文件。 您可以在以下位置找到可执行文件:
- C:\Windows C:\ Windows
- C:\Windows\System32 C:\ Windows \ System32
- C:\Windows\SysWOW64 (only on 64-bit versions of Windows) C:\ Windows \ SysWOW64(仅在Windows的64位版本上)
Use File Explorer to navigate to all of those locations. In each location, make a copy of the Notepad file by selecting the file, pressing Ctrl+C to copy it, and then pressing Ctrl+V to paste a copy. and choosing the “Copy” command. You will likely be asked to provide administrative permission in order to write the copy of the file to whatever system directory you’re in. Go ahead and click “Continue.”
使用文件资源管理器导航到所有这些位置。 在每个位置,选择一个文件,按Ctrl + C进行复制,然后按Ctrl + V粘贴一个副本,以创建记事本文件的副本。 然后选择“复制”命令。 您可能会被要求提供管理权限,以便将该文件的副本写入您所在的任何系统目录。继续,然后单击“继续”。
![](https://i-blog.csdnimg.cn/blog_migrate/bb3e604d2a6e2c75bd2b100e9f063658.png)
When you’re done, you’ll see the original and the copy you made.
完成后,您将看到原件和复印件。
![](https://i-blog.csdnimg.cn/blog_migrate/eb997609135d51250579b3809da8c624.png)
You can leave the name the way it is or rename it whatever you like. We usually go with something like “Notepad – Original.exe.” When you’ve made a copy of Notepad in all three locations, you’re ready to move on to the next step.
您可以按原样保留名称,也可以根据自己的喜好重命名。 通常,我们会使用“记事本– Original.exe”之类的东西。 在所有三个位置制作完记事本副本后,就可以继续下一步了。
第四步:拥有并删除记事本 (Step Four: Take Ownership of and Delete Notepad)
After making copies of all your “notepad.exe” files, the next step is to delete them. Unfortunately, it’s not as simple as just hitting the Delete key. Even if you’re logged on with an administrator account, you can’t just delete system files like Notepad. Fortunately, it’s still possible to take control of a file and delete it without resorting to nasty hacks like disabling UAC.
复制完所有“ notepad.exe”文件后,下一步就是删除它们。 不幸的是,这并不像按Delete键那么简单。 即使您使用管理员帐户登录,也不能仅删除记事本之类的系统文件。 幸运的是,仍然可以控制文件并将其删除,而无需借助禁用UAC之类的讨厌的方法。
Note that you’ll need to perform the following steps in all the locations that “notepad.exe” exists, so look back at that list in Step Two if you don’t already have those windows open in File Manager.
请注意,您将需要在“ notepad.exe”存在的所有位置执行以下步骤,因此,如果尚未在文件管理器中打开这些窗口,请回顾第二步中的列表。
Right-click the “notepad.exe” file and choose “Properties.”
右键单击“ notepad.exe”文件,然后选择“属性”。
![](https://i-blog.csdnimg.cn/blog_migrate/677ba5d2ece20d172f440a5fb949857e.png)
In the Properties window, on the “Security” tab, click the “Advanced” button.
在“属性”窗口中的“安全性”选项卡上,单击“高级”按钮。
![](https://i-blog.csdnimg.cn/blog_migrate/7b2d730e6946776c8c130f402ac222ec.png)
Note that the current owner of the file is listed as “TrustedInstaller.” You’re going to take ownership of the file with your account. Click the “Change” link.
请注意,文件的当前所有者列为“ TrustedInstaller”。 您将使用您的帐户取得文件的所有权。 点击“更改”链接。
![](https://i-blog.csdnimg.cn/blog_migrate/9e55888132274e13649425ed057f0880.png)
In the “Select User or Group” window, in the “Enter the object name to select” box, type your user account name, and then click the “Check Names” button. If you typed a valid name, the name should change to show the full user name path with the PC name before it. You can then click the “OK” button.
在“选择用户或组”窗口中的“输入要选择的对象名称”框中,键入您的用户帐户名称,然后单击“检查名称”按钮。 如果键入了有效的名称,则名称应更改为显示完整的用户名路径,并在其前显示PC名称。 然后,您可以单击“确定”按钮。
![](https://i-blog.csdnimg.cn/blog_migrate/1713903dd826724b7cf5186a763ceaa2.png)
NOTE: If you’re using a Microsoft account (rather than a local account), your official user name is just the first 5 letters of the full email address you used to set up the account. You’ve probably also noticed that those five letters were also used to name your user folder.
注意:如果您使用的是Microsoft帐户 (而不是本地帐户),那么您的正式用户名就是您用来设置该帐户的完整电子邮件地址的前5个字母。 您可能还注意到,这五个字母也用于命名用户文件夹。
Back in the “Advanced Security Settings” window, you’ll see that your user account is now listed as the owner of the “notepad.exe” file. Go ahead and click “OK.”
返回“高级安全设置”窗口,您会看到您的用户帐户现在被列为“ notepad.exe”文件的所有者。 继续,然后单击“确定”。
![](https://i-blog.csdnimg.cn/blog_migrate/a72d3c47f3d935590cf63a5fbbc7ee6d.png)
Back on the “Security” tab of the file’s Properties window, click the “Edit” button.
返回文件“属性”窗口的“安全性”选项卡,单击“编辑”按钮。
![](https://i-blog.csdnimg.cn/blog_migrate/565a16ba7fd95a223e6df751f964af3f.png)
In the Permissions window, select the “Administrators” group and then click to place a check mark in the “Allow” column for the “Full control” permission. Note that this will automatically fill in all the other check marks in the “Allow” column as well. You can now click “OK.”
在“权限”窗口中,选择“管理员”组,然后单击以在“允许”列中放置“完全控制”权限的复选标记。 请注意,这还将自动填写“允许”列中的所有其他复选标记。 您现在可以单击“确定”。
![](https://i-blog.csdnimg.cn/blog_migrate/350e23e99f57cde931d496bbb16479f9.png)
A security alert will pop up warning you that you’re about to change permission settings on system folders. Go ahead and click “Yes.”
将会弹出一个安全警报,警告您您将要更改系统文件夹上的权限设置。 继续并单击“是”。
![](https://i-blog.csdnimg.cn/blog_migrate/030d31c7900905ec33973b9cf71a45ed.png)
You can click “OK” to close the file’s Properties window.
您可以单击“确定”关闭文件的“属性”窗口。
![](https://i-blog.csdnimg.cn/blog_migrate/0e82a1caf8646d46fe880597e504965e.png)
Now, you should have all the permission you need to delete the “notepad.exe” file in this location. Just select it, hit the Delete key, and click Yes when you’re asked to provide administrative permission. When you’re done, “notepad.exe” should be gone, leaving you with just the backup copy you made earlier.
现在,您应该具有删除此位置中“ notepad.exe”文件所需的所有权限。 只需选择它,按Delete键,然后在要求您提供管理权限时单击Yes。 完成后,“ notepad.exe”应该消失了,只剩下您之前制作的备份副本。
![](https://i-blog.csdnimg.cn/blog_migrate/6d5d3633ac3b1f78b6f02ada0c166a6e.png)
Go ahead and perform all these steps in all the locations where you found the “notepad.exe” file. When you’re done, you’re ready to move on to the next step.
继续并在找到“ notepad.exe”文件的所有位置执行所有这些步骤。 完成后,就可以继续进行下一步了。
第五步:放入替换文本编辑器 (Step Five: Drop In Your Replacement Text Editor)
And now comes the easy part. Now that you’ve backed up and then deleted the “notepad.exe” file in all its locations, you’re finally ready to drop in the replacement executable file.
现在是最简单的部分。 现在,您已经备份并删除了所有位置的“ notepad.exe”文件,您终于可以放入替换可执行文件了。
First, find the executable file for the replacement text editor. If it was one you tested out, it may still be sitting on your desktop. Otherwise, you’ll need to find it in the app’s folder. Copy that executable file by selecting it and pressing Ctrl+C.
首先,找到替换文本编辑器的可执行文件。 如果是您测试过的计算机,则它可能仍坐在您的桌面上。 否则,您需要在应用程序的文件夹中找到它。 通过选择该可执行文件并按Ctrl + C来复制该可执行文件。
Next, go to each location where you deleted the original “notepad.exe” file and paste the replacement by pressing Ctrl+V. You will likely have to provide administrator permission to paste the file, so go ahead and click “Continue.”
接下来,转到删除原始“ notepad.exe”文件的每个位置,然后按Ctrl + V粘贴替换项。 您可能必须提供管理员权限才能粘贴文件,因此请继续并单击“继续”。
![](https://i-blog.csdnimg.cn/blog_migrate/956dc75493268228eb4df65974848980.png)
Right after you paste the copy, rename it to “notepad.exe.” You’ll likely need to provide administrator permission again for this step.
在粘贴副本后,立即将其重命名为“ notepad.exe”。 您可能需要为此步骤再次提供管理员权限。
![](https://i-blog.csdnimg.cn/blog_migrate/7ac1f47445a887db4dc9336180d1e022.png)
Don’t worry if the thumbnail changes to show the old Notepad icon. Go ahead and repeat these steps for all the locations where “notepad.exe” was originally located.
如果缩略图更改为显示旧的记事本图标,请不要担心。 继续并对“ notepad.exe”最初所在的所有位置重复这些步骤。
![](https://i-blog.csdnimg.cn/blog_migrate/57bb6d6c2f0517a5c3be177bea5529e3.png)
Once you’re done, you can test things out easily by hitting Start, typing “notepad,” and pressing Enter. Your new text editor should come up. And now, any time that Notepad is called by Windows or another app, you’ll get your preferred replacement editor instead.
完成后,您可以通过按Start(开始),键入“ notepad”,然后按Enter轻松地进行测试。 您的新文本编辑器将出现。 现在,只要Windows或其他应用程序调用记事本,您就会获得首选的替换编辑器。
翻译自: https://www.howtogeek.com/howto/12617/how-to-replace-notepad-in-windows-7/
项目中用到富文本编辑