简体   繁体   English

Linux Shell到Windows批处理文件

[英]Linux shell to windows batch file

I have a Windows dedicated server and I installed Multicraft to run Minecraft servers, and I wanted to add a accept EULA button, since I did not know much about bat files, so I found a sh file online and I did not want to use Cygwin because I don't know how to install it and make it run properly. 我有一个Windows专用服务器,并安装了Multicraft来运行Minecraft服务器,并且我想添加一个接受EULA按钮,因为我对bat文件了解不多,所以我在线找到了一个sh文件,并且我不想使用Cygwin因为我不知道如何安装它并使它正常运行。 I want to change this to a .bat file: 我想将其更改为.bat文件:

#!/bin/sh echo 'eula=true' > "$SERVER_DIR/eula.txt"

it basically finds the line eula=false in eula.txt and changes it to true from what i understand 它基本上在eula.txt中找到eula = false行,并根据我的理解将其更改为true

I would guess that this is what you're looking for: 我想这就是您要寻找的:

echo eula=true>>%SERVER_DIR%\eula.txt

Given the double greater-than symbol it should append the line to the indicated file. 给定大于号的双倍符号,应将行附加到指定的文件。 Note that we're using a backslash here. 请注意,我们在这里使用反斜杠。 You might want to look at the contents of that SERVER_DIR environment variable to see if it will work on a Windows-based computer. 您可能需要查看SERVER_DIR环境变量的内容,以查看它是否可以在基于Windows的计算机上运行。

If you want to mirror the behavior in the UNIX script then use a single greater-than symbol to overwrite the file content. 如果要在UNIX脚本中反映行为,请使用一个大于号来覆盖文件内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM