I whipped up a script to hide QEMU console windowForum: DSL Embedded Topic: I whipped up a script to hide QEMU console window started by: alcuin Posted by alcuin on Jan. 20 2007,18:35
Took me a long while, but I finally have it.-- runinvisible.vbs -- Set WshShell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") WshShell.CurrentDirectory=fso.GetParentFolderName(WSCript.ScriptFullName) 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. Posted by alcuin on Jan. 20 2007,18:55
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. regards, -e |