用于转换 Unix 行尾的 Windows 命令? [英] Windows command to convert Unix line endings?

查看:32
本文介绍了用于转换 Unix 行尾的 Windows 命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于转换文件行尾的 Windows 命令?

Is there a Windows command to convert line endings of a file?

我们有一个 test.bat 我们需要运行它来启动我们的服务器.我们使用 Perforce,我们需要在我们的工作区中有 unix 行结尾.出于某种原因,我们不允许在我们的工作区中将行结尾更改为 Windows.但是,服务器在 Windows 上运行.

We have a test.bat which we need to run to start our server. We use Perforce and we need to have unix line endings in our workspace. For some reason, we are not allowed to change line endings to Windows in our workspaces. However, the server runs on Windows.

每次我必须运行bat文件时,我都会在Notepad++中打开它并选择编辑→EOL转换→Windows.有没有办法自动执行此操作,以便我们每次与 Perforce 同步时都不需要手动更改行尾?

Everytime I have to run the bat file, I open it in Notepad++ and choose Edit→EOL conversion→Windows. Is there a way to automate this so that we won't need to manually change the line endings everytime we sync with Perforce?

提前致谢.

推荐答案

使用 Windows NT 及更高版本中包含的 more 命令实际上可以非常轻松地完成此操作.将包含 UNIX EOL (End Of Line) input_filename 转换为包含 Windows EOL output_filename代码>,只需这样做:

This can actually be done very easily using the more command which is included in Windows NT and later. To convert input_filename which contains UNIX EOL (End Of Line) to output_filename which contains Windows EOL , just do this:

TYPE input_filename | MORE /P > output_filename

more 命令具有您可能不知道的其他格式选项.运行 more/? 以了解 more 还能做什么.

The more command has additional formatting options that you may not be aware of. Run more/? to learn what else more can do.

这篇关于用于转换 Unix 行尾的 Windows 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆