Page 1 of 2

undeletable batch file

Posted: 10 Jul 2011 04:33
by Mohammad_Dos
I want to make a batch file that user can not delete that. is it possible?

Re: undeletable batch file

Posted: 10 Jul 2011 05:50
by aGerman
You need to be an administrator on the users computer ...
So, generally the answer is YES, but normally NO :wink:

Regards
aGerman

Re: undeletable batch file

Posted: 10 Jul 2011 11:08
by nitt
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".

Re: undeletable batch file

Posted: 10 Jul 2011 11:26
by aGerman
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

Re: undeletable batch file

Posted: 10 Jul 2011 11:35
by nitt
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.

Re: undeletable batch file

Posted: 10 Jul 2011 11:56
by Ed Dyreen
'
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 ..

Re: undeletable batch file

Posted: 10 Jul 2011 12:49
by Mohammad_Dos
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)

Re: undeletable batch file

Posted: 10 Jul 2011 13:03
by aGerman
Batch files are not locked, even if they are running or opened by a text editor. So that doesn't work.

Regards
aGerman

Re: undeletable batch file

Posted: 11 Jul 2011 17:20
by Cleptography
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:

Re: undeletable batch file

Posted: 11 Jul 2011 18:33
by orange_batch
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.

Re: undeletable batch file

Posted: 11 Jul 2011 19:25
by Cleptography
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.

Re: undeletable batch file

Posted: 11 Jul 2011 20:02
by dbenham
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

Re: undeletable batch file

Posted: 11 Jul 2011 20:25
by Cleptography
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.

Re: undeletable batch file

Posted: 11 Jul 2011 20:35
by orange_batch
Pour the gas on yourself.

Re: undeletable batch file

Posted: 11 Jul 2011 20:47
by Cleptography
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