AutoHotkey Community

It is currently May 27th, 2012, 1:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: September 8th, 2004, 3:59 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
This will let you select a file , make a bat file that will delete the file on the next reboot .
Code:
MsgBox, 4, , Would you like to continue?, 5  ; 5-second timeout.
IfMsgBox, No, Return  ; User pressed the "No" button.
IfMsgBox, Timeout, Return ; i.e. Assume "No" if it timed out.
; Otherwise, continue:
FileSelectFile, SelectedFile, 3, , Open a file, File (*.*)
FileAppend,Del  "%SelectedFile%" /y `n Del delete.bat`n, %userprofile%\start menu\programs\startup\delete.bat
SplashTextOn , 500, 200, Delete files on reboot,The File will be deleted on your next reboot !!!!
Sleep, 10000
SplashTextOff

edited . updated .


Last edited by Candle on September 9th, 2004, 1:10 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:07 pm 
What will delete the delete.bat in the startup folder once it has been executed ?

What happens @ the next startup after the target file has been deleted via the delete.bat ?

8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:15 pm 
Quote:
FileAppend,Del %SelectedFile% /y `n, %userprofile%\start menu\programs\startup\delete.bat


I haven't found within DOS' delete command any description on this "parameter" ?!
Can you help us here ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:15 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
i should make a file to delete the delete.bat . lol nothing happens on the next boot as that file is gone and will not delete it again as it is gone . lol


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:35 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
BoBo wrote:
Quote:
FileAppend,Del %SelectedFile% /y `n, %userprofile%\start menu\programs\startup\delete.bat



I haven't found within DOS' delete command any description on this "parameter" ?!
Can you help us here ?

the /y is a yes switch . it will not promp you to say YES to delete the file .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:35 pm 
Quote:
nothing happens on the next boot as that file is gone and will not delete it again as it is gone


Are you shure ?
I guess as it starts as a DOS command you'll get minimum a flashing DOS box. Bah, let's ignore it :roll:

What about if the system/user creates a file later sometime (maybe weeks later) with the same name as its stated within the batch file. It will be deleted by mistake. Hmm, hopefully it wasn't the final release of his/her Pulitzer Price worthy novel.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:36 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
hahahaha I added to the splash screen to delete the delete.bat on the next reboot.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:36 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
if you include 'Del %0%' as the last line of the .bat file, it'll delete itself.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:38 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
How would you add that to the file ? with a new line ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:39 pm 
Quote:
the /y is a yes switch . it will not promp you to say YES to delete the file


That's what I get as description on DOS' delete command (cmd.exe/W2K)

Quote:
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names Specifies a list of one or more files or directories.
Wildcards may be used to delete multiple files. If a
directory is specified, all files within the directory
will be deleted.

/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for archiving
- Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:43 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
If you find yourself trying to automate
the deletion of files, the formatting of
floppies, or do anything else REALLY
INTERESTING, you're going to hit a spot
where everything stops and you get asked
"Are you sure?". Sometimes you can pass a
"/y" on the command line (like the COPY
command) to override this, but that's the
exception. Often, you can simply ECHO the
key you'll need to press into the command.
As an example, suppose you want to run CHKDSK
with the /F option to fix errors. If it
finds errors, it will ask you to type "y"
or "n". You can create a batch file which
will do this for you:
http://www.ericphelps.com/batch/samples/yn.txt


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:47 pm 
Question:
Quote:
How would you add that to the file ? with a new line ?


Answer:
Quote:
include 'Del %0%'as the last line


Vinnie Jones: "Should I draw you a picture" from Lock,Stocks & Two Smoking Barrels :lol:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:51 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
Code:
MsgBox, 4, , Would you like to continue?, 5  ; 5-second timeout.
IfMsgBox, No, Return  ; User pressed the "No" button.
IfMsgBox, Timeout, Return ; i.e. Assume "No" if it timed out.
; Otherwise, continue:
FileSelectFile, SelectedFile, 3, , Open a file, File (*.*)
FileAppend,Del  %SelectedFile% /y `n, %userprofile%\start menu\programs\startup\delete.bat
SplashTextOn , 500, 200, Delete files on reboot,The File will be deleted on your next reboot !!!!
Sleep, 10000
SplashTextOff


Last edited by Candle on September 8th, 2004, 8:20 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 4:52 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
when I ran it it removed the % around the %0% .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2004, 5:05 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
Be nice if one time someone would say " hey thats nice thanks "
Not never mind..


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, sks and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group