Another Batch Command Question (Full Version)

All Forums >> [Other] >> Free Discussion



Message


killalot57 -> Another Batch Command Question (9/30/2008 11:00:46 PM)

Hello, I'm making a batch command to delete all the files in my "recent files" folder. At first I set it up so that it would create a .txt file in there, then delete all the files in there, so that I wouldn't get an error message when I ran it. Here is what I had...

@echo off
echo.>"C:\Documents and Settings\James\Recent\"file.txt
del /q "C:\Documents and Settings\James\Recent\*.*"
ECHO Arg, I'm getting Tired Of Making These!
ECHO.
PAUSE

What I'd like to do is have a command that will only tell it to delete the files there is one exist. So I tried the following command line in a different batch command.

@echo off
if exist "C:\Documents and Settings\James\Recent\*.*" del /q "C:\Documents and Settings\James\Recent\*.*"
echo hi everyone
echo.
PAUSE

I get most of my command lines from friends "sithtracy" and random internet people, so I can't really figure out what to change myself. I tried a few variations but I haven't been getting anywhere...




SithTracy -> RE: Another Batch Command Question (10/18/2008 9:51:40 AM)

This is pretty easy to accomplish... it seems you have a ton of batch file questions in you so I am going to direct you to Google Groups (classically known as Usenet) - alt.msdos.batch.nt.  There is a wealth of knowledge out there for whatever you seek.  Just avoid the dumb questions like how to add a date/time stamp to a file name.  It is probably best to use the search function because what you are asking has been done a 1000 times over.




killalot57 -> RE: Another Batch Command Question (10/19/2008 3:49:52 AM)

Well okay then, thanks




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0