[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

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?
0
rae_rae
Asked:
rae_rae
  • 5
  • 4
1 Solution
 
parkerigCommented:
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
0
 
parkerigCommented:
Stand corrected. My XP machine recognises ERASE
I'll get back to you.

0
 
rae_raeAuthor Commented:
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
parkerigCommented:
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
0
 
rae_raeAuthor Commented:
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.
0
 
parkerigCommented:
Hi,
The %1 effectively runs temp.bat filename
The file must me dropped onto the ICON ( apologies - explanation wasn't that clear ) and it will work ok but it makes the user instructions obsolete as they are just dropping onto the icon not the opened batch file. I will try and find a reference to see if a %variable exists for files dropped onto open DOS windows but I am unaware of one

Apologies for confusion

Ian
0
 
rae_raeAuthor Commented:
Awesome! I'll wait for another post but as it stands, you have been very helpful to me. Thanks again!
0
 
parkerigCommented:
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
0
 
rae_raeAuthor Commented:
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 ;-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now