linux - Windows 相当于 ">/dev/null &"

标签 linux windows bash

我有下面的代码用于运行在 .sh 文件中使用 mongodb 的代码。我在 Windows 中运行我的代码,但我认为这些命令适用于 Linux。如果有人能让我知道 Windows 中的等效命令,我将非常感激。

#!/bin/bash

base_dir="$1"
echo "Starting MongoDB..."
mongodb/bin/mongod --dbpath "$base_dir"/mongodb/data/db > /dev/null & 
sleep 10

echo "Starting Jetty server..."
java -Xmx8g -jar easy_esa.jar 8800 index &
sleep 10

最佳答案

对于Windows来说,在后台运行程序有点不同。最好的方法是将其设置为服务。这是short manual如何从程序创建服务。

Step One: Install SrvStart

Step Two: Create a Configuration File for the New Service

Step Three: Use the Command Prompt to Create the New Service

/dev/null 在 Windows 中是 NUL: 所以你的命令将变成:

command parameters > NUL:

关于linux - Windows 相当于 ">/dev/null &",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53897099/

相关文章:

linux - GNU Parallel - 将输出重定向到具有特定名称的文件

Java 从 Mac/Linux Dock 隐藏应用程序

git - 为什么 'git ls-files' 没有在 Tab 完成时显示?

linux - 使用 set -u 进行 bash 调试

c++ - 使用 Qt creator 编写屏幕保护程序 - 在屏幕保护程序设置中显示预览

windows - 批量字符串连接

windows - Emacs latex 模式下的文件名编码

linux - LNMP 服务器上的多个 php (php-fpm) 版本

linux - 这个 Cron 的时间表是什么?

c - 远程过程调用 : how to declare two versions of same program in a XDR file