0

So basically, I do a lot of mod work in my spare time. However, this can create an unnecessarily large amount of files that I want to delete. So, I created a batch file that pretty much deletes every file (image files, model files, etc) but knowing myself, I have a gut feeling that I might one day accidentally open the batch file and screw myself over. What I'm wondering is, is it possible to create a "warning" in the batch file? Such as, "Warning! Proceeding will delete all files that haven't been backed up. Press any key to proceed." being an example? I haven't been able to find someone who has a similar request. Thanks for reading through this! I'd appreciate any help.

TL;DR: When a batch file is opened, is it possible to have a warning message that appears before any commands are run?

Holly
  • 1
  • 2
  • `echo` followed by a `pause`? – Richard Feb 21 '17 at 08:02
  • 3
    I think this is generally considered poor UI - everyone is so accustomed to clicking OK every time, and 90% of the times you run it will be deliberate, so you will click it and do the OK answer automatically and then regret it. [cite1](http://stackoverflow.com/questions/2455768/ux-question-is-better-to-have-serious-delete-or-have-trash) which links to [cite2](https://alistapart.com/article/neveruseawarning) - use Volume Shadow Copy and the recycle bin and automatic backups so you can undo. – TessellatingHeckler Feb 21 '17 at 08:06

1 Answers1

1
@echo off
set /p proceed=warning - enter x to proceed
if /i "%proceed%" neq "x" goto :eof
... now do your thing

You get prompted and must press x and enter to proceed.

Magoo
  • 77,302
  • 8
  • 62
  • 84