1.

Solve : edit my batch file?

Answer»

hi there this is my first time on here

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
:OKAY
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?

i can help you with some of this.

try it first, of course with two small  files,  filea and fileb

if you use the copy command
copy filea+fileb     you will get a screen prompt which asks if you want to OVERWRITE etc. i do not know how to get around that but in the earlier dos environments, that was not asked. at any rate fileb will be attached to filea so that the resulting filea will have the original filea trailed by fileb within it.

i would not use del *.* as it will also ask for a confirmation, but RATHER know the file name you wish to delete or use wildcards if they all begin with the same letter or letter. that way you will not get the confirmation request.

start with these ideas and build your batch. respond if this is not part of what you want to do



Discussion

No Comment Found