Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a simple BAT or (shell) script, newbie question.

Status
Not open for further replies.

humour

Programmer
Nov 24, 2003
87
This is what I want.

Filename : sol.bat ( or sol.XXX) where xxx is some extension.

What the program should do....

1) Append the date and time sol.bat was executed to a file.

2) Run sol.exe (The solitaire program).

----------------------------------------
Yes I wnat to monitor an employee that is supposed to be working but instead is playing games.

I DO NOT WANT a sermon as to why or why not this is a good idea or a bad idea. I simply want help with this program.

Any replies highly appreciated.

Thanks in Advance.
 
And what have you tried so far ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
you might like to think about a generic script which is started when the machine boots, the script can just sit there and monitor all services/exes whcih are started.
or you can have a little ini file which is read by your startup script for which exe's you want to audit and where to chuck the audit info.
the script would have to sit running in the backgroumd in a loop which isnt great but something to play with i guess.
advantage would be to avoid the user thinkin, oh why do i want to start the app with a batch file which audits me when i can just hit the exe. all sounds a bit Mi5 though ;-)
 
What about if the user opens sol.exe just once and keeps it minimized? He/She could be playing all day, but technically, the file was opened once. You should consider blocking the game at all (at least in his/her computer).
Anyway, you could try this VBS, you will have to replace the shortcut to solitaire to go to this file instead.

Code:
dim logfile
logfile = "c:\solitaire.log"

dim message
message = "playing solitaire: " & date & " " & time

Set fso = wscript.CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(logfile)) Then 
	Set logfile = fso.OpenTextFile(logfile, 8) ' 8 = Append
	logfile.writeline (message)
	Set logfile = nothing
else
	Set logfile = fso.CreateTextFile(logfile)
	logfile.WriteLine(message)
	Set logfile  = Nothing
end if
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run ("C:\WINDOWS\system32\sol.exe")
set WshShell =nothing

hope this helps,

Alexis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top