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

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

问题描述

是否有一个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.

每次我需要运行批处理文件,我在记事本+ +中打开它,然后选择编辑→ 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和后来的更多命令完成。要转换 input_filename ,其中包含UNIX EOL(行尾) \\ n 输出文件名其中包含Windows EOL \\ r \\ n ,只是这样做:

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) \n to output_filename which contains Windows EOL \r\n, just do this:

TYPE input_filename | MORE /P > output_filename

更多命令有,你可能不知道的附加格式设置选项。运行更多/?学习还有什么更多可以做。

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

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

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