gpt4 book ai didi

command-line - Notepad++ 打开文件,更改编码并从命令行保存

转载 作者:行者123 更新时间:2023-12-04 09:47:24 24 4
gpt4 key购买 nike

我从命令行搜索使用 Notepad++ 执行自动化任务的方法:

  • 打开文件
  • 将编码更改为 UTF-8
  • 保存文件

  • 有没有办法用一些插件甚至其他程序来做到这一点?

    最佳答案

    为什么要使用 Notepad++ 来完成该任务?您使用的是哪个操作系统?
    Notepad++ 有一个插件管理器,您可以在其中安装 Python 脚本插件。

    http://pw999.wordpress.com/2013/08/19/mass-convert-a-project-to-utf-8-using-notepad/

    但是,如果您想将文件转换为 UTF8,您可以使用 Windows 上的 PowerShell 或 Linux 上的命令行更轻松地完成此操作。

    对于 Windows 电源 shell :

    $yourfile = "C:\path\to\your\file.txt"
    get-content -path $yourfile | out-file $yourfile -encoding utf8

    对于 Linux 使用(例如) iconv:
    iconv -f ISO-8859-15 -t UTF-8 source.txt > new-file.txt

    关于command-line - Notepad++ 打开文件,更改编码并从命令行保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24481776/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com