Bitcoin Forum

Bitcoin => Mining => Topic started by: theGECK on March 23, 2011, 06:23:57 PM



Title: Hiding the command window
Post by: theGECK on March 23, 2011, 06:23:57 PM
Here's a question - I would like to hide the command window for the miners on my machine. The miners don't affect my machine's performance, throttle down when I want to watch/play something, and then come right back up when I'm done with it. Since I haven't closed any of them down for quite some time, I'd like for the command prompt to be hidden when I launch it, or at least off of my taskbar (Windows). Is there a way to do this?


Title: Re: Hiding the command window
Post by: MikeDaSpike on March 23, 2011, 07:09:37 PM
Google movetotray or minimize to tray. There are several apps that can minimize any window to the system tray.


Title: Re: Hiding the command window
Post by: hangover on March 24, 2011, 05:43:19 AM
Or you can write simple AutoIt script (miner-starter) to start miner from it and compile it to exe with corresponding option.


Title: Re: Hiding the command window
Post by: Herodes on March 28, 2011, 05:43:31 PM
Here's a vb-script that I made. It will hide the cmd window from showing. Change it to your needs and put it in a .vbs-file in the startup folder:

Code:
'Script to start bitcoin and poclbm.exe in the background.
'Will track time run in seconds in c:\bitcoin\logs\run.log

'run bitcoin server
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run "cmd /C START /b C:\bitcoin\bitcoin-0.3.20.01\daemon\bitcoind.exe", SHOW_ACTIVE_APP, FALSE

' Delay 10 seconds
WScript.Sleep 10000


Dim starttime
starttime = Now()

Set objShell2 = Wscript.CreateObject("Wscript.Shell")

objShell.CurrentDirectory = "C:\bitcoin\poclbm_py2exe_20110222" 
objShell2.Run "C:\bitcoin\poclbm_py2exe_20110222\poclbm.exe --user=username --pass=password --device=0 --verbose --rate=60 >> c:/bitcoin/logs/rate.log", SHOW_ACTIVE_APP, False


Dim endtime
endtime = Now()


Dim timedif

timediff = starttime - endtime


Dim logdata, myFSO, logfile, dateStamp
dateStamp = Date()

'Write information to Text File
Dim secs

logdata = DateDiff("s",starttime,endtime)

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set logfile = myFSO.OpenTextFile("C:\bitcoin\logs\runtime.log", 8, True)
logfile.WriteLine(logdata)
logfile.Close
SET logfile = NOTHING
SET myFSO = NOTHING


Title: Re: Hiding the command window
Post by: LMGTFY on March 28, 2011, 05:49:25 PM
What about running bitcoind (bitcoind.exe?) as a Windows service? You'd be able to start/stop/restart it through the "Services" management console GUI, and there would (I presume) be no unpleasant terminal window.

Disclaimer: reason I mention this is because someone asked how to do this fairly recently, here on the forum, and my "contribution" was less than stellar, as I recall (it's been some time since I last regularly used Windows...)


Title: Re: Hiding the command window
Post by: [Tycho] on March 28, 2011, 05:54:55 PM
Also those windows will not be shown if you run miners as different user in Windows, using scheduler.


Title: Re: Hiding the command window
Post by: bobR on March 28, 2011, 05:58:16 PM
Create a shortcut to start it... start minimized ... add it to your start up file

or schedule it as a task to run at start up ad never see it
or schedule it only to run when idle


Title: Re: Hiding the command window
Post by: urizane on March 28, 2011, 09:47:35 PM
The point of the original post was to get the terminal windows off of his taskbar.  For me, I don't mind the terminal windows since minimizing things puts them at the end of the Alt+Tab list.  I generally don't mess with the taskbar unless I want to mess with the clock.


Title: Re: Hiding the command window
Post by: theGECK on March 28, 2011, 09:55:34 PM
Also those windows will not be shown if you run miners as different user in Windows, using scheduler.

So, if I had multiple user accounts on a machine, I could use the scheduler to run something and it won't show up? So, I could run a .bat file to join a pool, and it wouldn't show the command prompt? I will test this out.


Title: Re: Hiding the command window
Post by: Ricochet on March 30, 2011, 05:17:16 AM
I've always been a fan of the "PowerMenu" app for minimizing programs to the tray.  It's a *really* small and simple file (less than 150 KB) and it does what it's supposed to do.  I use the version that doesn't require installation, though I'm guessing the installer version would have an option to start at bootup if you'd like.

http://www.abstractpath.com/powermenu/


Title: Re: Hiding the command window
Post by: TurdHurdur on March 30, 2011, 05:40:53 AM
I like hidec.exe/RunHiddenConsole.exe which you can get from http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zip, where I originally found the link here: http://wiki.nginx.org/PHPFastCGIOnWindows. It's only 2KB and I use it for a scheduled task that rysncs a file on a remote server. Security software may complain about it, seeing it can be used for malicious purposes.

If you still want output, you could make a shortcut like:

Target: C:\path\to\hidec.exe cmd /C "miner.exe --arguments values > output.txt"
Start in: C:\path\to\miner

You'll have to kill them from Task Manager, which isn't a big deal with miners.


Title: Re: Hiding the command window
Post by: theGECK on March 30, 2011, 04:56:40 PM
So, I've discovered a VBS script can make a hidden window. Here's where I am:

This is a VBS script that can launch something. In this case, Ufasoft's CPU miner.
Code:
Set objApp = CreateObject("WScript.Shell") 
objApp.Run "cmd /C C:\CPUMiner\bitcoin-miner.exe -o http://mining.bitcoin.cz:8332 -u theGECK.noway -p idontthinkso -g no"

M$ has a sample script up here (http://gallery.technet.microsoft.com/ScriptCenter/8bbed56f-a7aa-491f-a296-687dd96098a3/) that lets you launch notepad in a hidden window. You can kill notepad from the task manager, but not go to it using alt+tab. Right now, I'm assuming that you are essentially just running the notepad.exe but because the window is set to hidden, are unable to use it.
Code:
Const HIDDEN_WINDOW = 12 
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
 
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("Notepad.exe", null, objConfig, intProcessID)

So, I'm now trying to figure out how exactly to make this launch the CPU miner in the hidden window. I would continue to work on this right now, but I need to get some work done that isn't bitcoin related, so I figured I'd put my discoveries here for y'all. My assumption is that just changing notepad.exe won't work, since the GetObject above it is specifying root, but I could be very wrong, and maybe all that is needed is to paste the Ufasoft string into where it says notepad.exe.


Title: Re: Hiding the command window
Post by: Miner-TE on March 30, 2011, 05:45:50 PM
This works for me.  Save file as .VBS and modify the command line

C:\Mine\ufasoft\bitcoin-miner.exe -t 2 -o http://mining.bitcoin.cz:8332 -u <USERNAME> -p <Password>


Code:
Const HIDDEN_WINDOW = 12 
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
 
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\Mine\ufasoft\bitcoin-miner.exe -t 2 -o http://mining.bitcoin.cz:8332 -u <USERNAME> -p <Password>", null, objConfig, intProcessID)



Title: Re: Hiding the command window
Post by: BitterTea on March 30, 2011, 06:05:54 PM
You could use Kiv's poclbm GUI (http://bitcointalk.org/index.php?topic=3878.0). I think it's really slick, and hides in the task bar when not in use.


Title: Re: Hiding the command window
Post by: theGECK on March 30, 2011, 07:20:01 PM
You could use Kiv's poclbm GUI (http://bitcointalk.org/index.php?topic=3878.0). I think it's really slick, and hides in the task bar when not in use.

I do, which is what made me want something similar (or better) for the Ufasoft's CPU miner that I run.

Or for when I visit a friend's house and want to "use his computer to check my email". :)