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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File to delete

Status
Not open for further replies.

irweazel

IS-IT--Management
Jan 19, 2005
74
GB
I am trying to write a batch file to delete some files containing certain text - taken from a user input

i.e.

user types XXX at the prompt it finishes command

del *XXX*.doc \\source\e$

could probably do it using choice and the IF command but just want to be able to type the letters/digits and let it do the business

it's hard to convey five-dimensional ideas in a language evolved to scream defiance at the monkey in the next tree
 
something like:
mybatchfile.bat
Code:
del *%1*.doc

And then you would call it like:

c:\>mybatchfile.bat text_in_files_to_delete


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
its ok got what i needed


set choice=
SET /P Choice=Type in the 3 letter for the month and press enter:
SET Choice=%Choice:~0,3%
ECHO.
del *%Choice%*.doc

by changing %Choice:~0,3 to something higher you can choose how many letter you are going to input

it's hard to convey five-dimensional ideas in a language evolved to scream defiance at the monkey in the next tree
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top