Is it possible to set up a batch file on a Windows XP system that a user will be able to execute but not read (type, edit, etc.)?
I tried playing with permissions, allowing "Execute File" but not "Read Data" but it doesn't seem to work.
Batch files, by default, are at the very least viewable/readable to anyone with sufficient permissions on the machine they are running on.
If you need to create a file that will is not readable you'll need to use some different file. Any script (vbs, batch, powershell, jscript) will be viewable by anyone able to run the file.
Even executables can be viewed. It is only the difference in how they can be viewed that allows some sort of hiding of the contents of a file.
Because script files are, by definition, text-based instruction lists, they can be viewed easily, in a text editor.
UPDATE (Added per comment): The problem with encryption is that as the script is run it must be unencrypted.
I guess you have to decide who you want to prevent from reading the script: Must it be unviewable in any situation by anybody, or just by most average people?
If it is sufficient to keep it from being viewed by average joes, just remove the Edit entry for batfiles from the registry and make sure the script runs with minimal output. If you have to keep it away from everybody, you need to find some other way of running it.
You can always convert a batch file to an exe using something like BTEC, although as music2myear has pointed out even that wouldn't prevent someone determined enough from viewing much of its contents.
I dont think you can but have a look here for advanced permissions and what they do http://www.ntfs.com/ntfs-permissions-file-advanced.htm
First of all - a big thank you to all the participants!
Before I continue to the solution, let me give you more details why it was needed in the first place.
We have a batch file that runs a database script to update some tables.
The script needs a password to connect to the database, so it was specified in the batch file.
The solution involved the following:
As an added bonus, the task can be started remotely:
Again, thank you for your responses.