1.

Solve : Need Help Creating a Simple Batch File?

Answer»

Hello everyone!

USING command prompt to get a cookies list:
C:\Documents and Settings\Owner>cd cookies
C:\Documents and Settings\Owner\Cookies> dir >c:\mydirfile.txt

Can someone help me TRANSLATE this into batch file language?

Thanks!Why do you want this?Why do you think it needs "translating"? Go back to your teacher and tell him you do not understand your homework.
Why Do I Want This?

I created a PROGRAM that "analyzes" employee cookies - based on 1) time of day (employee's own time?), and 2) appropriateness to the job.  It's obviously a crude program, which doesn't take much to finesse.  When it comes to my attention that an employee in one of our offices is suspected of severely abusing the internet, but no cookies show up to be analyzed (despite the fact that policy prohibits employees deleting them) my program is pretty useless.

Existing options aren't so good:  Keep walking by the employee's desk to see how often he/she appears to be surfing, or report suspected abuse to our central office, which has all the sophisticated software for monitoring this type of thing, but doesn't want to share it at the local level.   When the higher-ups are contacted inevitably everyone else down the line wants to know why local management wasn't "paying attention".

So I thought a batch file that would get a a new cookie list every 5 minutes or 15 minutes or whatever would be a good way to see if the suspected employee is in fact deleting cookies as fast (or nearly as fast) as he/she creates them.

This type of batch file would not be something to use on a routine basis, but only when we suspect the employee is deleting cookies to hide his/her internet activity.

Why do you think it needs "translating"? Go back to your teacher and tell him you do not understand your homework.

"Translate" is a poor word choice.  But it seems to me the conventions for command prompts and for batch files are similar, but not identical.  I am my own teacher, except for what I learn on the forums.

Thanks for the responses.

Quote from: pilk00 on July 29, 2008, 07:20:00 PM

Hello everyone!

Using command prompt to get a cookies list:
C:\Documents and Settings\Owner>cd cookies
C:\Documents and Settings\Owner\Cookies> dir >c:\mydirfile.txt

Can someone help me translate this into batch file language?

Thanks!

Well, I'm not sure if I know what you mean but I'll try:

Code: [Select]echo off
cd C:\Documents and Settings\Owner\Cookies
start mydirfile.txt
exit
I don't think this would exactly help your problem, but why don't you install a keylogger, or a screen recorder?

Use google, if you don't like the links I provided.

PS. Why don't you guys jsut answer him. It doesn't matter what it's for. He's just requesting help.Thanks, Mr. Google!

I worked with your coding till I got something that worked:
     
     echo off
     cd C:\Documents and Settings\Owner\Cookies
     dir >c:\mydirfile.txt
     exit

My next question:

    I'd like to insert the "sleep" command and "goto start" at the end.  If I enter "sleep 1", the txt file will   
be overwritten every second.  But --- I don't want to overwrite, I want to store additional iterations of
the text file for each loop - per second, minute, hour or whatever.

    I figure I may need an "IF" statement that will recognize "c:\mydirfile.txt" already exists and so store
a renamed file such as mydirfile1.txt on the c: drive.

Once again, I'm clueless about the coding.  I can barely manage VBA.

Thanks!No problem. I'm not too sure about you next question as I am not to advanced with batch coding, but I think you'll have to do something with a variable like %dirfile%+1 or something although I'm not sure how to do that. Maybe someone else COULD help. Sorry...why are you doing this the "hard" way? I am sure you have Internet proxy server logs , or software that logs internet connections in place?I work for a large federal agency - not the CIA, NSA or anything like that.  We help people.

As I explained earlier, our agency (bureaucracy) is rigid when it comes to internet tracking.  Each office has a server.  If the server has a "proxy server log" I don't know what it is or where to find it.

At the national level, the agency keeps repeating the mantra about "proper use" of government property.  Management at a more local level is more proactive - showing zero tolerance for time-wasting personal surfing.  Problem is at the local level we don't have the tools for monitoring - so we invent them.

I created an Access-based program that filters cookie text files for apparent patterns of abuse.  It's a crude instrument.  The question has come up about what to do about employees who routinely delete their cookies before they can be collected and analyzed.  So I see the batch file monitoring tool as a supplement to the filtering program - to be used only for cases in which we suspect there's more personal internet use going on than what the cookies suggest.

Anyway I didn't get into computers until Windows 95 - so I find batch files intriguing.Another approach would be to write a monitor script (VBScript) that would fire each time a cookie is created in the cookie directory.

Quote
I created an Access-based program that filters cookie text files for apparent patterns of abuse

When the script FINDS a new cookie (file) in the directory, your Access program could be started to do the analysis.

VBScript is a subset of VBA, so the transition would be fairly simple.



Discussion

No Comment Found