How to do batch file password protect?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
vbose
Posts: 1
Joined: 13 Aug 2013 12:03
Location: India
Contact:

How to do batch file password protect?

#1 Post by vbose » 13 Aug 2013 13:09

Hi Friends,

I am trying to protect my batch script file. But it is very difficult to get it down because once I use the nested if condition then file automatic close, it doesn't compile the code and even not read full of condition.

Even I try to use "Pouse" keyword to stop the closing process the file but if there is any mistakes then it automatically close it. Please help me out so I can rectify this issue.

Thanks
Vikas Bose

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: How to do batch file password protect?

#2 Post by penpen » 13 Aug 2013 13:18

I fear this problem cannot be solved without seeing, how you want to protect your batch file, or am i missing something?
Btw: If you mean a batch programming keyword, then it should be pause.exe instead of Pouse (and it is no keyword, but a program).

penpen

Magialisk
Posts: 104
Joined: 25 Jul 2013 19:00

Re: How to do batch file password protect?

#3 Post by Magialisk » 13 Aug 2013 21:26

Are you trying to make it so that nobody can *run* the batch file without a password, or so that nobody can *read* the batch file without a password? The latter is quite difficult, your best bet might be to .zip it in that case, or use some other 3rd party tool?

The former is relatively simple. Basically store an encrypted password in the batch file along with an encryption algorithm. Prompt for a password on launch, run the text through the cipher and compare the two. Of course if someone can read/edit the batch they can just delete out the bits where you do the password check...

Please elaborate one what you're trying to protect and how, and perhaps we can offer some suggestions.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How to do batch file password protect?

#4 Post by foxidrive » 14 Aug 2013 00:07

I get the impression that he wants to debug a flaw in the script.

If that is the case then open a cmd window and CD to the folder, and type in the name of the batch file to launch it. You will see any error messages.

Post Reply