Making A Program Run With No GUI

Associate
Joined
27 Aug 2006
Posts
435
Hey there...

I am getting well into batchfiling recently and for those of you who know how to batchfile, probably agree how incredibly usefull this is!

However, I am trying to get some surveillence going for when I am away from my desk.

I am doing this using my Nokia mobile phone as a webcam via bluetooth and using a Motion Detection program for monitering my desk while I am away.

I have created some batch files that upon launching via some shorcut keys, run the Motion Detection program and then minimize it into the taskbar.

Unfortunatly if someone came to my desk to have a quick look at my files without my permission (dont wanna use a password... its too much hassle and there isnt really a point to it as they are so easy to get round) they would see "Motion Detection" in the taskbar and realize whats happening.

I would like to be able to have a program that could launch the Motion Detection program into the background process'. i.e, it does its job but out of sight, only viewable in the taskmanager > process tab as the .exe (MDetect.exe). Or even if there is a program prebuilt into Windows XP that would do this using the correct syntax, I would very much like to know the name of the .exe.


Any help whatsoever would be greatly appreciated, this would be all I needed to know in order to complete this project of mine.


Any questions releating to the setup incase you are interested of doing the same thing, please dont hesitate to ask.


Thank you...
 
errm the only time i have seen this possible is if it is built in to the program - there is sometimes an option.

im not sure if you can do this otherwise but i could be wrong.

daven
 
Thanks for the swift response "daven1986".

I have seen this many a time before having a switch like /hide or /background, unfortunatly mothion detection has nothing of the sort. Just to let you know, incase it helps at all, I use the folowing use the following:

start /min MDetect /capture

Thanks for taking the time out to reply though daven1986, much appreciated...
 
Hi,

I used to use a program that would run a Windows executable as a service. Can't remember what it was called (winserv rings a bell). A long time ago (back in the days of NT4.0) so it might not still be available.

Have a look at www.application-as-service.com or www.firedaemon.com which would seem to do something similar. Might be worth a look to see if something like that'll do the job.

Jim
 
Thank you very much for your reply "JIMA"

These look enticing so I will look into them very shortly, however I was hoping to have something that could be run form the command line so that it could be used in a batchfile, sorry if I didnt make this very clear but this would be the ideal end result.

Thanking you once again in taking time out to reply...
 
I saw in one of the screenies on the 1st link a command line bit of code. not sure if that is what you'd use to run the app as a service but these 2 look pretty good so should be able to do what you want.

daven

a little OT but do you have any websites that have info on making batch files?
 
daven1986 said:
a little OT but do you have any websites that have info on making batch files?

Yes, yes I do...

A very good site for this is http://www.computerhope.com

This site really gave me a good understanding of batchfiles and how to make them.

Here is a little something to wet your appitite...

In Windows XP (this is the only OS I have batched in I am afraid), open up notepad.exe, quickest way is by going start > run > notepad.exe > OK, or to get to run dialog quick, use windows key + R. Or you can do it all the GUI way and go to start > all programs > accessories > notepad.


Anyhow, now type (I reccomend typing just to get used to things... never copy and pased examples as you dont get the "jist" of batching) the following:

@Echo off
title My First BatchFile
echo Hello World...
echo.
pause

Save the file somewhere on your hard disk and when saving select the "save as type" dropdown box and selec all files, save it as Hello.bat and then once saved, launch it. Alternitivly if you are used to changing file extensions manually, just rename Hello.txt to Hello.bat.


Here is an example of one of my own batch files:





REM PROGRAM LENGTH: 57 LINES



REM FOR USE ONLY WITH WINDOWS XP



REM THIS PROGRAM IS DESIGNED BE USED INSTEAD

REM OF A NORMAL SHUTDOWN (shutdown -s -t 0)

REM A BACKUP OF "OUTLOOK 2003 MAIL", "FIREFOX

REM SETTINGS" AND "MY DOCUMENTS" IS MADE. IT

REM ALSO REMOVES TEMPORARY FILE CLUTTER,

REM PROVIDING THAT ITS NOT IN USE.

REM AND THEN THE PROGRAM SHUTS

REM THE COMPUTER

REM DOWN




REM _____________________
REM ( PROGRAM STARTS HERE )
REM """""""""""""""""""""
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :: ::
REM :::::::: ::::::::
REM :::::: ::::::
REM :::: ::::
REM :: ::


@Echo off
c:
START /min mplay32 /play /close %windir%\media\notify.wav
title Shutdown Program ( beta1 )
COLOR F0
cls
echo --------------------------------------------- >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
date /t >> ".\Backup Log.txt"
time /t >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
echo.
echo * BACKING UP OUTLOOK 2003 MAIL *
echo.
echo TERMINATING OUTLOOK.EXE (IF EXISTS)
echo.
taskkill.exe /f /im outlook.exe
xcopy "C:\Documents and Settings\owner\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst" ".\Outlook\Mail\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
echo.
echo BACKED UP OUTLOOK 2003 MAIL
echo.
echo * BACKING UP FIREFOX SETTINGS *
echo.
echo TERMINATING FIREFOX.EXE (IF EXISTS)
echo.
taskkill.exe /f /im firefox.exe
xcopy "C:\Documents and Settings\owner\Application Data\Mozilla\Firefox\Profiles" ".\Firefox\Profiles\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
echo.
echo BACKED UP OUTLOOK 2003 MAIL
echo.
echo BACKED UP FIREFOX SETTINGS
echo.
echo * REMOVING TEMPORARY FILES *
echo.
rd /q /s c:\docume~1\owner\locals~1\tempor~1 >> ".\Backup Log.txt"
md "c:\docume~1\owner\locals~1\Temporary Internet Files" >> ".\Backup Log.txt"
rd /s /q c:\docume~1\owner\locals~1\temp >> ".\Backup Log.txt"
md c:\docume~1\owner\locals~1\temp >> ".\Backup Log.txt"
cls
echo.
echo BACKED UP OUTLOOK 2003 MAIL
echo.
echo BACKED UP FIREFOX SETTINGS
echo.
echo REMOVED TEMPORARY FILES
echo.
echo * BACKING UP MY DOCUMENTS *
echo (this may take a while)
echo.
xcopy "C:\Documents and Settings\owner\My Documents" ".\MY DOCUMENTS\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
SHUTDOWN -S -T 10 -C "BACKUP AND TEMPORY FILE REMOVAL COMPLETE"



This belive it or not is an extremly simple batch file in comparison to other I have made, but I thought it would be good as an example to you as it has explanations within it. Please excuse the general messed up look of things occasionally, this is because of the restriction on the forums width focing parts onto separate lines.

I hope this was of help to you and any others interested in this...

*edit* Another piece of advice is to get used to the command prompt. start > run > cmd, or start > all programs > accessories > command prompt.

Manvure yourself though directories and try copying things from a to b, get as used to it as you are with windows' GUI. This will help a lot, trust me! type "help" from within command prompt for some of the inbuilt programs used for listing contents of directories (type "dir") and copying things (type copy or xcopy), adding a /? to any of the commands provided in help (i.e dir /?) will provide most switch options, switch's are used to define paramiters of a program... i.e "dir /a" lists all files (including hidden and system now because of the /a) and attrib test.txt +s adds the system attribute to test.txt in the current dir.
 
Last edited:
yeah im pretty cool with cmd but have never ventured too far! your post was really helpful and it was a useful batch file too. will give this a go soon.

thanks

daven
 
wouldn't it be easier just to set a password and lock your workstation when you leave your desk?

bear in mind that with no password anyone can view all your files when you are not there

HT
 
happytechie said:
wouldn't it be easier just to set a password and lock your workstation when you leave your desk?

bear in mind that with no password anyone can view all your files when you are not there

HT

yeah but he wants to capture and torture them, not prevent them :D
 
Dj_Jestar said:
er.. tbh, just windows key+L as you get up to walk away from desk..

wow I didn't know that one, thanks Jestar :D

I can't believe that I've been ctrl-alt-del and then space bar to lock my PC when that'll do it, think of all those key strokes I could have saved :eek:

HT
 
Shoseki said:
yeah but he wants to capture and torture them, not prevent them :D
Yup, you got it in one there Shoseki!

Dj_Jestar said:
er.. tbh, just windows key+L as you get up to walk away from desk..
I already know the key combination but I dont need to lock the workstation, incase you wanted this in a batch though, use the tool nircmdc.exe (goolgle it, probably under nircmd.exe) and add the lockws syntax... i.e

nircmdc lockws will lock the workstation, incase you wanted to have it in a batch...


Any idea with the "running program with no gui, in the background..."

Thanks for all your reply's guy's... much appreciated...
 
To run the "Motion Detection" software, is it just a case of running an .exe file?

Or does it involve more such as running the .exe and clicking a certain menu.
 
srvany/firedaemon is also the way I'd go. You can control service start/stop from a batch file. However, your mileage may vary (it's possible for a service to still interact with the Windows desktop).

All sounds a bit dodgy to me though. I don't know whether this desk of which you speak is at home or at work. If the latter, then snooping around your workplace like some dodgy secret agent isn't going to do you any favours with your employer. If the former, then it's your call, but I'd say that mobile phone you're using as a camera would be a prime and obvious target.
 
bluetech said:
This belive it or not is an extremly simple batch file in comparison to other I have made, but I thought it would be good as an example to you as it has explanations within it. Please excuse the general messed up look of things occasionally, this is because of the restriction on the forums width focing parts onto separate lines.

Use code tags to preserve formatting...

Code:
  like so...
  and so
    and so
  and so

  and so....

;)
 
If you have an nVidia card you can enable multiple desktops and then just hide it on one of the (non visible) desktops :P. If you dont you might be able to get some other multiple desktop software.
 
dan0r2 said:
To run the "Motion Detection" software, is it just a case of running an .exe file?

Or does it involve more such as running the .exe and clicking a certain menu.
It is just a case of running the exe, I use a few swithces in order to start the capture... do you have any ideas then?

Berserker said:
srvany/firedaemon is also the way I'd go. You can control service start/stop from a batch file. However, your mileage may vary (it's possible for a service to still interact with the Windows desktop).

All sounds a bit dodgy to me though. I don't know whether this desk of which you speak is at home or at work. If the latter, then snooping around your workplace like some dodgy secret agent isn't going to do you any favours with your employer. If the former, then it's your call, but I'd say that mobile phone you're using as a camera would be a prime and obvious target.
It is for at my home desk... just so you know. I agree this wouldent be a good thing for the workplace.

Lagz said:
If you have an nVidia card you can enable multiple desktops and then just hide it on one of the (non visible) desktops :P. If you dont you might be able to get some other multiple desktop software.
Wouldent this still leave the application in the primary monitors taskbar?

ByteJuggler, gonna test that code thing... cheers...

Code:
REM            FOR USE ONLY WITH WINDOWS XP



REM       THIS PROGRAM IS DESIGNED BE USED INSTEAD

REM        OF A NORMAL SHUTDOWN (shutdown -s -t 0)

REM       A BACKUP OF "OUTLOOK 2003 MAIL", "FIREFOX

REM       SETTINGS" AND "MY DOCUMENTS" IS MADE. IT 

REM         ALSO REMOVES TEMPORARY FILE CLUTTER,

REM            PROVIDING THAT ITS NOT IN USE.

REM              AND THEN THE PROGRAM SHUTS

REM                    THE COMPUTER

REM                        DOWN




REM               _____________________
REM              ( PROGRAM STARTS HERE )
REM               """""""""""""""""""""
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM               ::                 ::
REM            ::::::::           ::::::::
REM             ::::::             ::::::
REM              ::::               ::::
REM               ::                 ::


@echo off
c:
START /min mplay32 /play /close %windir%\media\notify.wav
title Shutdown Program ( beta1 )
COLOR F0
cls
echo --------------------------------------------- >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
date /t >> ".\Backup Log.txt"
time /t >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
echo --------------------------------------------- >> ".\Backup Log.txt"
echo.
echo                         * BACKING UP OUTLOOK 2003 MAIL *
echo.
echo TERMINATING OUTLOOK.EXE (IF EXISTS)
echo.
taskkill.exe /f /im outlook.exe
xcopy "C:\Documents and Settings\Doody\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst" ".\Outlook\Mail\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
echo.
echo                           BACKED UP OUTLOOK 2003 MAIL
echo.
echo                         * BACKING UP FIREFOX SETTINGS *
echo.
echo TERMINATING FIREFOX.EXE (IF EXISTS)
echo.
taskkill.exe /f /im firefox.exe
xcopy "C:\Documents and Settings\Doody\Application Data\Mozilla\Firefox\Profiles" ".\Firefox\Profiles\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
echo.
echo                           BACKED UP OUTLOOK 2003 MAIL
echo.
echo                           BACKED UP FIREFOX SETTINGS
echo.
echo                          * REMOVING TEMPORARY FILES *
echo.
rd /q /s c:\docume~1\doody\locals~1\tempor~1 >> ".\Backup Log.txt"
md "c:\docume~1\doody\locals~1\Temporary Internet Files" >> ".\Backup Log.txt"
rd /s /q c:\docume~1\doody\locals~1\temp >> ".\Backup Log.txt"
md c:\docume~1\doody\locals~1\temp >> ".\Backup Log.txt"
cls
echo.
echo                           BACKED UP OUTLOOK 2003 MAIL
echo.
echo                           BACKED UP FIREFOX SETTINGS
echo.
echo                             REMOVED TEMPORARY FILES
echo.
echo                           * BACKING UP MY DOCUMENTS *
echo                             (this may take a while)
echo.
xcopy "C:\Documents and Settings\Doody\My Documents" ".\MY DOCUMENTS\" /h /c /i /y /e >> ".\Backup Log.txt"
cls
SHUTDOWN -S -T 10 -C "BACKUP AND TEMPORY FILE REMOVAL COMPLETE"
 
Unfortunately i don't think you will be able to accomplish this yourself.

In visual basic i have had a look at running a process as hidden, this works for dos cmd windows, but will not work for external applications.

You can hide your bat file window, but when it calls the .exe Windows will display the main window of the program.

Programactially you would have to intercept the OS calls of the .exe to get close to hiding the window.

The most straight forward walkaround i can see is using third party window hiding software.

A google search for "winxp hide window" turned up results.

The main issue i think you would have is trying to load the program hidden, the solutions seem to hide a window after it has been run (could be automated to a certain extent if you really wanted).

If you dig around however you may find something suitable.

Hope this helps.
 
Back
Top Bottom