Link to home
Start Free TrialLog in
Avatar of rae_rae
rae_raeFlag for United States of America

asked on

A batch file delete utility

@echo off
echo Drag and drop your file(s) to delete into this window...
Pause >NUL
echo >> asdfasdf1234567890asdfasdfjlkjquiutysyuyteyyysyeythssh >NUL
echo >> asdfasdf1234567890asdfasdfjlkjquiutysyuyteyyysyeythssh >NUL
echo >> asdfasdf1234567890asdfasdfjlkjquiutysyuyteyyysyeythssh >NUL
echo >> asdfasdf1234567890asdfasdfjlkjquiutysyuyteyyysyeythssh >NUL
erase /f /q
echo Job Done, Going off.
echo Click here and press any key...
pause >NUL
end

The above commands are what i have in my delete utility and i am getting a syntax error when i drop any file into the window.
What it is supposed to do is write the line "asdfasdf1234567890asdfasdfjlkjquiutysyuyteyyysyeythssh" quietly to the file, 4 times,
then erase the file by force and all this, quietly.
Does anyone have any answers on how to fix this?
Avatar of parkerig
parkerig
Flag of New Zealand image

Hi,
don't believe erase is a dos command.
Is it a special program ?
If it is I suggest you use the full path

Let me know

Ian
Stand corrected. My XP machine recognises ERASE
I'll get back to you.

Avatar of rae_rae

ASKER

Actually, I'm running this in winxp and have named the file delete.cmd. The program is going to be a simple utility to write a specified number of times - over the existing data that gets 'dropped into the window' and then erased. The full path to the file is entered into the utility by dropping it into the window. This can be demonstrtated by dropping any file into cmd.exe while running it.
Hope this adds more to help you guys understand what i'm wanting to do...
Thanks.
The batch file is failing as it is not recognising the file you are dropping onto the window.
You can confirm this by just pressing the space bar to continue - same error.
If you just drop the file onto the batch file it will work if you change the line erase /f /q to

erase %1 /f /q

but this of course assumes user knows to do this

Cheers
Ian
Avatar of rae_rae

ASKER

Maybe you could try this on your machine 'if you havn't', and let me know the exact syntax to put into the code since i am still getting the same error with this...Maybe i'm just slow. Btw, What does the %1 do? Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of parkerig
parkerig
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rae_rae

ASKER

Awesome! I'll wait for another post but as it stands, you have been very helpful to me. Thanks again!
Haven't been able to find any info on dropping the file onto the open dos window but I have bookmarked this and if something comes up I'll drop a line

Ian
Avatar of rae_rae

ASKER

Thanks, sorry i didn't get back to say so sooner but i'm visiting family for thanksgiving. Have a happy one...to you and your's ;-)