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

Suicidal batch script?

Status
Not open for further replies.

sakpgu

Technical User
Aug 9, 2005
19
0
0
US
Hello:
--Newbie here with an odd batch script problem. The script, which I want to use with Task Scheduler, permanently deletes files in the target directory then moves itself to the Recycle Bin.
--The issue occurs no matter what I folder I launch it from. It doesn’t seem to matter whether I click the executable or run it from a command prompt. The server OS is Win2k3 SP1. Here’s the script:

del "C:\Program Files\Exchsrvr\Mailroot\vsi 1\UCEArchive" *.* /q

--Apologize if I posted to the wrong forum. I’d be grateful for any tips, for I’m basically clueless when it comes to scripting.
Regards,
Patrick
 
Try this line:
Code:
del "C:\Program Files\Exchsrvr\Mailroot\vsi 1\UCEArchive\*.*" /q[/quote]

When you put the line in quotes, with no ending slash and then have a space *.* it looks like two items in a list of things to deletes from the specified path then it deletes from the current path.


[COLOR=blue]At my age I still learn something new every day, but I forget two others.[/color]
 
Oh, to clarify. Since your path was just a directory with no file specified it defaults to deleting all files in the directory, then it hit the *.* without a path a deletes everything within the current directory the batch file is executing from.


At my age I still learn something new every day, but I forget two others.
 
--That did the trick. I figured it was a typo. As a former newspaper editor, you think I would've caught the error. Thanks a lot.
Regards,
P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top