I have many batch-files, using user-id and password. is there a possibility
to encrypt the password inside the batchfile, so users from outsid won't see
the password?
thanks
Instead of hard-code the password you could save the password in a text
file w/appropriate security settings (requires an NTFS formatted drive).
To set a variable PW to the password:
For /F %%P In (passwordfile) Do Set PW=%%P
A while ago, I used an "enhancement" of this method:
I started DEBUG and typed
e100 "set PW=mypassword"D A
Then I typed 'd100' to get a hexdump of the above. Based on that data I
created a debug script (say %SystemRoot%\pw.dbg) like this:
e0100 73 65 74 20 50 57 3D 6D 79 70 61 73 73 77 6F 72
e0110 64 0D 0A 66 61 73 64 66-0D 0A CD 21 34 00 58 0C
rcx
13
w
q
Whenever I needed the password I used this commands
Type NUL > %TEMP%.\$PW.BAT
Debug %TEMP%.\$PW.BAT < %SystemRoot%\pw.dbg > NUL
For %%C In (Call Del) Do %%C %TEMP%.\$PW.BAT
::For example:
Net Use * \\server\share %PW% /user:angusyoung
HTH
--
Frank-Peter Schultze, http://www.fpschultze.de
> I have many batch-files, using user-id and password. is there a possibility
> to encrypt the password inside the batchfile, so users from outsid won't see
> the password?
This is usualy being done by revoking all NTFS rights from the batch files
except for the account the batch in question will run under.
If you are creating the scripts 'on the fly' you can also write
another batch file GIVEPWD.CMD which only echoes the password
on system output and hide GIVEPWD.CMD using NTFS rights:
---GIVEPWD.CMD---
@ECHO mysecretpwd
---SENDFTP.CMD---
ECHO username > %TEMP%\FTP.SCR
CALL GIVEPWD.CMD >>%TEMP%\FTP.SCR
ECHO binary >>%TEMP%\FTP.SCR
ECHO put aFile >>%TEMP%\FTP.SCR
ECHO bye >>%TEMP%\FTP.SCR
FTP -i -s:%TEMP%\FTP.SCR
DEL %TEMP%\FTP.SCR
Bye,
v
Sr.
>>> Hallo Frank
>>> Dein dbg File scheint nicht so richtig zu funktionieren. Hast Du eine
Idee?
>>> Gruss und danke
>>> PS. Angus, I got the Jack!
Remove the hyphen (-) in the next line