Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can a .bat file access a password stored in file?

Author  Topic 

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2005-02-09 : 17:04:41
We have several batch jobs that have hard coded login ids and passwords. The long-term goal is to implement NT Authentication. The short-term goal is to store an encrypted password in a file and have the batch jobs access the password through the use of global variables.

(1) How can I store an encrypted password in a file?
(2) How can a DOS .bat job access the encrypted password and use it as the password parameter to access SQL Server.

I'm guessing this is done somehow with global variables, but my DOS knowledge in this area is minimal.

Any suggestions.

Thanks, Dave

Kristen
Test

22859 Posts

Posted - 2005-02-10 : 01:16:28
A bit crude but:


A.BAT
=====
@ECHO OFF
SET PWD=FRED

B.BAT
=====
@ECHO OFF
CALL A.BAT
ECHO My password is %PWD%

Kristen
Go to Top of Page

DBADave
Constraint Violating Yak Guru

366 Posts

Posted - 2005-02-10 : 10:17:19
Thanks Kristen. The more I think about it, using global variables may not be an option. There are two issues I need to address. (1) Anyone with administrator permission could see the passwords stored in the file. We don't want this. (2) The person (night operator) who runs the batch jobs would have the ability to type SET and see the values (passwords) assigned to the global variables. Don't want this either.

Any suggestions?

Dave
Go to Top of Page

Auric
Yak Posting Veteran

70 Posts

Posted - 2005-02-10 : 11:22:42
DBADave

You could write the same sort of "Batch file" of sorts in C++ and have it compile to an EXE. the end user would see nothing but the executable. C++ has a wonderful little command called system("yercommandhere") that allows you to interface with the operating system.

Select * from users where clue > 0
Go to Top of Page
   

- Advertisement -