Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: running a batch file  (Read 6600 times)

0 Members and 1 Guest are viewing this topic.

batchgirl

  • Guest
running a batch file
« on: December 03, 2004, 10:04:26 AM »
I do have a question on a batch file if you do not mind.

I am creating this batch file below:

1. Create a batch file, Micr.bat, which will accomplish the following:
a. Update a log file on your C:\root folder. Call this log file cleanup.log. Each time your batch file is run it should over-write this log file which contains the User Name (utilizing the %USERPROFILE% environmental variable),
b. Merge this file onto the back-end of the file cleanup.hst which will also be stored in the C:\ root folder.
c. List the directory contents of this TEMP folder.
d. Ask for the user’s permission to proceed with the deletion of all these files.
e. If the user responds positively, then delete all the files from the user’s TEMP file.
f. Remember to copy the textbook’s REPLY.COM to the folder containing your batch file.
g. Place this batch file in the C:\BatchFiles folder.


This is what I have come up with:

@echo off
rem (BAT)
rem (EVA)
rem (dec 2 2004)

FOR %%a IN (%USERS%) DO IF "%1"=="%%a" GOTO OKAY
:NO
ECHO YOU, %1, are NOT allowed in the system.
GOTO END
KAY
ECHO Welcome %1 to the system.
:END
c:\setup.exe /L2 c:\Logfiles\cleanup.log  
c:\ move cleanup.log a:\cleanup.hst  
c:\ dir /TEMP  
REM This Batch program deletes all files in the TEMP folder in the current folder.
REM I will give the user to react and abort this process.
@ECHO OFF
ECHO WARNING: Going to delete all files in the temp folder
ECHO Press CTRL+C to abort or simply press a key to continue.
PAUSE
DEL TEMP *.*  
c:\ copy REPLY.com C:\EVA  
IF %1==Eva GOTO EVA
Echo Is anyone there?
GOTO FINISH
:end

Can you please tell me if i am on the correct track?

Corrosive

  • Guest
Re: running a batch file
« Reply #1 on: December 03, 2004, 11:31:54 AM »
I can't give you much advice on batch files (I rarely use them anymore) but your logic seems to be correct, although I believe you mis-spelled the word "OKAY" in line 10.

batchgirl

  • Guest
Re: running a batch file
« Reply #2 on: December 03, 2004, 01:33:14 PM »
Thank you.

I was really not to sure where "forum topic" to send my issue. Well I guess I am were I was before I made the post.

I apologize for the repeated posts.