Since batch files are normally in plain text I'm not sure that VB will be much help. Permissions on text files are normally an OS thing. But this will bump you up- maybe someone else knows of something that I don't.
Excellent. The you can hide the contents of your batch files in an NTFS stream. I'm not in front of NT box at the moment, so you'll have to wait a few hours before I can give you some illustrative code.
Off the top of my head, something like the following: [tt]
Private Sub Command1_Click()
Dim hFile As Long
hFile = FreeFile
Open "c:\mytest.bat:datastream" For Output As hFile
Print #hFile, "dir"
Close hFile
Shell "c:\mytest.bat:datastream"
End Sub
Now, if another user does a Dir, looking for your batch file, all they will find is c:\mytest.bat. If they try and cat it, or edit it, or run it they won't get anything. They need to know the name of the stream before they can access it.
One thing about streams to consider, the batch file strongm mentioned will be 0 bytes long. if someone deletes it, your stream, and therefore your batch file will be gone.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.