Reputation: 11026
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
Upvotes: 2
Views: 17507
Reputation: 175
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.
Upvotes: 0
Reputation: 52655
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.
Upvotes: 2