undeletable batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

undeletable batch file

#1 Post by Mohammad_Dos » 10 Jul 2011 04:33

I want to make a batch file that user can not delete that. is it possible?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: undeletable batch file

#2 Post by aGerman » 10 Jul 2011 05:50

You need to be an administrator on the users computer ...
So, generally the answer is YES, but normally NO :wink:

Regards
aGerman

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: undeletable batch file

#3 Post by nitt » 10 Jul 2011 11:08

Mohammad_Dos wrote:I want to make a batch file that user can not delete that. is it possible?


Um... I don't know. I think it may be possible, like making it a system file or something. But the closest solution I can think of is just hiding the file.

Code: Select all

@echo off
echo set fso = createobject("scripting.filesystemobject") : set file = fso.getfile("file.bat") : file.attributes = 2 > ~tmp.vbs
start ~tmp.vbs
ping 0 -n 1 > nul
del ~tmp.vbs


That will hide the file "file.bat".

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: undeletable batch file

#4 Post by aGerman » 10 Jul 2011 11:26

The batch command to do that is ATTRIB. But the user could configurate his explorer to show all files (incl. hidden & system files) and he could also clear these attributes.

Regards
aGerman

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: undeletable batch file

#5 Post by nitt » 10 Jul 2011 11:35

aGerman wrote:The batch command to do that is ATTRIB. But the user could configurate his explorer to show all files (incl. hidden & system files) and he could also clear these attributes.

Regards
aGerman


Oh, cool. I knew there was a command for it, I just couldn't remember what it was. But ya.

Code: Select all

@echo off
attrib +h file.bat


Okay, there. Fixed the code.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: undeletable batch file

#6 Post by Ed Dyreen » 10 Jul 2011 11:56

'
Windows tracks open files.

If a program terminates in a way that leaves the file open, ( crashed while writing it )
It can't be deleted until reboot.

I've read somewhere it was possible to close such a file without rebooting,
simply by removing it from a list.

I never investigated this, I should implement this, Is it possible ?

I currently track all files a batch opens by registery keys, the above would make this obsolete.

Well it can be done, I'm just lazy ..

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: undeletable batch file

#7 Post by Mohammad_Dos » 10 Jul 2011 12:49

hiding the batch file is not a good idea. user may understand

but leave that file runing is a better...
can someone help me about it?

(sorry for my english)

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: undeletable batch file

#8 Post by aGerman » 10 Jul 2011 13:03

Batch files are not locked, even if they are running or opened by a text editor. So that doesn't work.

Regards
aGerman

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: undeletable batch file

#9 Post by Cleptography » 11 Jul 2011 17:20

Modify the file permissions as any other file. Maybe add some reg keys, but there is no permanent way as you call it, maybe to those not familiar with their OS but what is done can always be undone. You would be better off writing a 0 byte asm proggie. :lol:

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: undeletable batch file

#10 Post by orange_batch » 11 Jul 2011 18:33

I still don't trust this guy. His previous threads allude to him trying to build a type of virus, and now this.

viewtopic.php?f=3&t=1355

viewtopic.php?f=3&t=1557

dostips.com/forum/search.php?keywords=&terms=all&author=Mohammad_Dos&sc=1&sf=all&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search

Windows version / registry data / internet connectivity threads etc

I apologize if I'm wrong.

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: undeletable batch file

#11 Post by Cleptography » 11 Jul 2011 19:25

So what if he is trying to build a virus. Who cares it is in the destruction that builds a foundation. Without evil there can be no good, for it is all good.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: undeletable batch file

#12 Post by dbenham » 11 Jul 2011 20:02

orange_batch wrote:I still don't trust this guy. His previous threads allude to him trying to build a type of virus, and now this.

viewtopic.php?f=3&t=1355

viewtopic.php?f=3&t=1557

dostips.com/forum/search.php?keywords=&terms=all&author=Mohammad_Dos&sc=1&sf=all&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search

Windows version / registry data / internet connectivity threads etc

I apologize if I'm wrong.

I'm with you Orange. I was suspicious just from his recent posts, but those old posts you dredged up are even more incriminating. I imagine there are much more effective techniques for building a virus than batch, but his posts make me uncomfortable.

Dave Benham

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: undeletable batch file

#13 Post by Cleptography » 11 Jul 2011 20:25

There is no such thing as a batch virus, ridiculous is what that is. Who cares about viruses, who cares about any of it, just let it all die. I think just for kicks I'm going to pour gasoline all over my computer and set it ablaze, at least then I get to be the one that enjoys the carnage.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: undeletable batch file

#14 Post by orange_batch » 11 Jul 2011 20:35

Pour the gas on yourself.

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: undeletable batch file

#15 Post by Cleptography » 11 Jul 2011 20:47

orange_batch wrote:Pour the gas on yourself.

Oh orangutan my feelings have been bruised, though I do enjoy drinking gasoline.
Does your mother enjoy biocide?
Image

Locked