Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: I whipped up a script to hide QEMU console window< Next Oldest | Next Newest >
alcuin Offline

Group: Members
Posts: 2
Joined: Sep. 2005
Posted: Jan. 20 2007,18:35 QUOTE

Took me a long while, but I finally have it.

-- runinvisible.vbs --
Set WshShell = WScript.CreateObject("WScript.Shell")

Set fso = CreateObject("Scripting.FileSystemObject")

runbatch = "dsl-base.bat"
if (WScript.Arguments.count<>0) then runbatch = WScript.Arguments(0) end if
wshShell.Run """"& runbatch &"""",0,False
-- end runinvisible.vbs --

Just copy and paste between the dashes into a Notepad file; save the file as "runinvisible.vbs".  Copy it to your dsl embedded directory, into the same directory as the dsl-base.bat file.  If you double-click on it, it will run dsl-base.bat by default.  If you drag and drop one of the other batch files, like dsl-windows.bat, or dsl-pendrive.bat, onto the runinvisible.vbs icon, it will run those instead, but also hide their console windows.

Some notes:
1) This has only been tested on XP SP2, though it should run on W2K.  No guarantees yet though, please leave me feedback and lmk how it goes.
2) You must place the runinvisible.vbs file in the same directory as the batch file you want it to run.  Before, I had this horrible issue that if I dragged and dropped a file onto it, it would execute the file from the %UserProfile% directory.  I have it now set to look for the directory of the .vbs file, and execute the batch file from there.  This should be ok, since you'll probably only want to use this script with DSL/QEMU.  If you want to use it with anything else, you're free to modify, but you're on your own.  I would rather have the script search for the path of the file dropped onto it, but seeing that the argument is passed as a whole, it is rather difficult for me to figure out how to parse out just the path, without the file name.  If someone figures it out, please let me know, or modify it and post it.
3) Also as important, this requires a very very small modification to the batch file you intend to run.  This has absolutely no adverse affect on running QEMU afaik.  You must edit the dsl-base.bat or any other batch file you want to run, and edit the line that starts with

START qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -soundhw sb16 -localtime -kernel linux24 -initrd minirt24.gz -hda KNOPPIX/knoppix -hdb qemu/harddisk .....

and delete out the word START, so you're left with something like

qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -soundhw sb16 -localtime -kernel linux24 -initrd minirt24.gz -hda KNOPPIX/knoppix -hdb qemu/harddisk .....

 START causes qemu to be spawned into another process, which the script has no control to keep hidden.  Without it, qemu simply runs within the batch file.  The one difference is, without start, the cmd window will stay open, in the back-background, but visibly hidden.  If you open up task manager, you can see it there, but not on your desktop.  Using the START command would prevent it from being in your task manager, but the script would not be able to control the hidden aspect.  The script could be completely rewritten to directly call QEMU, which would be the best case scenario; no batch file to cause a command window to stay open.  But then the script would be completely tied to DSL and the configuration must be modified within the script.  This probably can and will be done in the future, but for now, the script is usuable with most past and present versions of DSL Embedded out there.
Back to top
Profile PM 
alcuin Offline

Group: Members
Posts: 2
Joined: Sep. 2005
Posted: Jan. 20 2007,18:55 QUOTE

Okay, so here's the script to directly launch QEMU with the DSL image from the script, without calling the batch file, and without having a cmd.exe process in the background, and having the QEMU console window hidden at the same time. :)

-- start dsl-base.vbs --
Set WshShell = WScript.CreateObject("WScript.Shell")
runbatch = "qemu\qemu.exe -L qemu/ -no-kqemu -m 128 -localtime -kernel linux24 -initrd minirt24.gz -hda KNOPPIX/knoppix -append ""qemu vga=791 quiet noscsi nousb nofirewire atapicd noideraid noacpi acpi=off noapm noagp ide1=noprobe ide2=noprobe nomce frugal"" "
WshShell.Run runbatch,0,False
-- end dsl-base.vbs --

It's very plain and simple and easy.  If you want to edit it for future DSL Embedded, remember a couple things.
1) Don't put in START.  You don't need it.  Not with this method.
2) If/when you're copying the qemu\qemu.exe..... line from a batch file, or just editing options, into this script;
a: You must begin and end the command on the "runbatch = ..." line with double-quotes.
b: Since the VBS is looking for the double-quotes to know the name of the string, if you want to use double-quotes for QEMU command line options, you must double double-qoute.  Just look at the example, it should make sense.  If it doesn't, lmk.

Back to top
Profile PM 
1 replies since Jan. 20 2007,18:35 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Quick Reply: I whipped up a script to hide QEMU console window

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code