在后台运行一个带有invisible.vbs的BAT文件,但是如何停止它呢?

发布于 2024-10-31 02:05:44 字数 1384 浏览 2 评论 0原文

我正在使用类似于此处提到的解决方案​​在后台运行bat文件,但是相关的 bat 文件在后台运行比特币 GPU 挖矿程序。有时我想停止矿工,但由于我试图以不可见的方式运行它(因为我不希望它出现在我的任务栏中),所以我无法停止该过程。我什至在进程管理器中找不到它(没有 cmd.exe 或 conhost.exe)。 [我什至不确定它是否正在运行。] 有帮助吗?

编辑:它肯定正在运行;用窗口打开进程显示矿工以一半的容量运行,这在过去表明矿工打开了两次。

edit2:这里是批处理文件的内容,如果有帮助的话。< /em>

我运行的批处理文件来启动一切:

wscript.exe "D:\Desktop\invisible.vbs" "C:\Program Files (x86)\Bitcoin\DiabloMiner\bpm.bat"

bpm.bat:

cd "C:\Program Files (x86)\Bitcoin\DiabloMiner"
java -cp target\libs\*;target\DiabloMiner-0.0.1-SNAPSHOT.jar -Djava.library.path=target\libs\natives\windows com.diablominer.DiabloMiner.DiabloMiner -u <username> -p <password> -o <pool> -p 8332 -w 64 -f 1000

invisible.vbs:

set args = WScript.Arguments
num = args.Count

if num = 0 then
    WScript.Echo "Usage: [CScript | WScript] invis.vbs aScript.bat <some script arguments>"
    WScript.Quit 1
end if

sargs = ""
if num > 1 then
    sargs = " "
    for k = 1 to num - 1
        anArg = args.Item(k)
        sargs = sargs & anArg & " "
    next
end if

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run """" & WScript.Arguments(0) & """" & sargs, 0, False

I'm using a solution like the one mentioned here run bat file in background but the bat file in question runs a Bitcoin GPU miner in the background. Sometimes I want to stop the miner, but since I am trying to run it invisibly (because I don't want it in my taskbar) I can't stop the process. I can't even find it in my process manager (no cmd.exe or conhost.exe). [I'm not even sure it's running.] Any help?

edit: It is most definitely running; opening the process with a window shows that the miner was running at half capacity, which in the past indicated the miner was open twice.

edit2: here are the contents of the batch files, if it helps.

batch file I run to start everything:

wscript.exe "D:\Desktop\invisible.vbs" "C:\Program Files (x86)\Bitcoin\DiabloMiner\bpm.bat"

bpm.bat:

cd "C:\Program Files (x86)\Bitcoin\DiabloMiner"
java -cp target\libs\*;target\DiabloMiner-0.0.1-SNAPSHOT.jar -Djava.library.path=target\libs\natives\windows com.diablominer.DiabloMiner.DiabloMiner -u <username> -p <password> -o <pool> -p 8332 -w 64 -f 1000

invisible.vbs:

set args = WScript.Arguments
num = args.Count

if num = 0 then
    WScript.Echo "Usage: [CScript | WScript] invis.vbs aScript.bat <some script arguments>"
    WScript.Quit 1
end if

sargs = ""
if num > 1 then
    sargs = " "
    for k = 1 to num - 1
        anArg = args.Item(k)
        sargs = sargs & anArg & " "
    next
end if

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run """" & WScript.Arguments(0) & """" & sargs, 0, False

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我闹别瞎闹 2024-11-07 02:05:44

如果没有看到批处理的内容,我的猜测是 CMD.exe 运行您的批处理,该批处理启动您的比特币进程,然后结束。这可以解释为什么您看不到 CMD.exe。

如果您想查看 cmd.exe 的示例,您可以创建一个像这样永不结束的批处理。

:TOP
REM FOO
GoTo TOP

然后使用该批处理运行 inivisible.vbs,您将在任务中看到 cmd.exe。如果您使用进程资源管理器,您将能够在图像的命令行中看到批处理文件的名称。看起来像这样

`cmd /c ""C:\Whaterver\Looptest.bat" "

更新

正如 Harry Steinhilber 已经指出的那样,进程将是 java.exe

如果您运行进程资源管理器并选择Java.Exe 你应该在命令提示符中看到这个

java -cp target\libs\*;target\DiabloMiner-0.0.1-SNAPSHOT.jar -Djava.library.path=target\libs\natives\windows com .diablominer.DiabloMiner.DiabloMiner -u <用户名>; -p <密码> -o <池> -p 8332 -w 64 -f 1000

这将允许您从正在运行的其他 java 应用程序(如果有)中识别 DataMiner。

Without seeing the contents of the batch my guess is the CMD.exe runs your batch which launches your bitcoin process and then ends. This would explain why you're not seeing CMD.exe.

If you want to see an example when you would see cmd.exe you can create a batch that never ends like so.

:TOP
REM FOO
GoTo TOP

Then run inivisible.vbs with this batch and you'll see the cmd.exe in your task. If you use process explorer you'll be able to see the batchfile's name in the command line for the image. Which would look something like this

`cmd /c ""C:\Whaterver\Looptest.bat" "

UPDATE

As Harry Steinhilber already pointed out the process will be java.exe

If you run process explorer and select the Java.Exe you should see this in the command prompt

java -cp target\libs\*;target\DiabloMiner-0.0.1-SNAPSHOT.jar -Djava.library.path=target\libs\natives\windows com.diablominer.DiabloMiner.DiabloMiner -u <username> -p <password> -o <pool> -p 8332 -w 64 -f 1000

This will allow you to identify the DataMiner from other java applcations (if any) that you are running.

如歌彻婉言 2024-11-07 02:05:44

您可以使用 VBScript。

set shell=createobject("wscript.shell")
dim cmdline
cmdline="C:\path\to\yourprogram.jar" ' HERE
set wmi=getobject("winmgmts:{impersonationLevel=impersonate}!\\"&shell.expandenvironmentstrings("%computername%")&"\root\cimv2")
for each process in wmi.instancesof("Win32_process")
    if process.name="java.exe" and instr(process.commandline,cmdline)>0 then
        process.terminate
    end if
next

抱歉排了很长的队。将此处的文本更改为 jar 文件的位置,它将终止它。

You can use VBScript.

set shell=createobject("wscript.shell")
dim cmdline
cmdline="C:\path\to\yourprogram.jar" ' HERE
set wmi=getobject("winmgmts:{impersonationLevel=impersonate}!\\"&shell.expandenvironmentstrings("%computername%")&"\root\cimv2")
for each process in wmi.instancesof("Win32_process")
    if process.name="java.exe" and instr(process.commandline,cmdline)>0 then
        process.terminate
    end if
next

Sorry about the long line. Change the text where it says HERE to the location of your jar file and it will terminate it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文