The batch file I am going to show you can encrypt text and the second file can decrypt it.the batch file isn't mine but I thought it was very interesting and anyone reading this might like it. The original code can be found here. Batch File Text Encrypt/Decrypt. By Blurryface21 in Technology. All you gotta do is copy and paste the below code into a notepad file, and save it as anything.bat.
![Text Text](http://cdn.windowsreport.com/wp-content/uploads/2015/09/encrypt-files-windows-10.png)
Hi All, I have a batch script which connects to an Oracle database and executes sql scripts via the sqlplus command. It works fine, however the connection details are in plain text which isn't ideal for security; but getting the connection working was the main thing first. Now that I've moved onto the security side of the script, I have created a setup where a txt file exists and contains the username/password for the database.
![Bat Bat](/uploads/1/2/5/4/125414136/631515889.png)
The main batch script reads in the username/password into 2 variables and these variables are what's used in the connection string of the main batch script. So the connection details are never seen in plain text in the main batch script, they are only seen in the txt file which it reads from. My issue is I want to encrypt this text file which contains the username/password, so only selected users can access it.
Is there a way I can encrypt the username/password file (without a 3rd party software if at all possible) and still have the main batch script call it and read the username/password into the 2 variables as explained above? So the only way the username/password file is ever seen in plain text is if it is decrypted with the key/passphrase by selected users on my team. I know Linux has an Mcrypt command line tool which allows the user to issue the command and decrypt the contents of the file and also read the contents into a variable.
This is like my scenario above however I am not aware of any windows equivelants for this? Any help would be greatly appreciated and please find example snippets below. I am on a Windows 7 machine. Connection details string in main batch script @echo off call config.bat SET CONNECT=%var1%/%var2%@example.world config.bat script: @echo off pushd 'Y: Private Config' for /f 'delims='%%x in (config.txt) do (set '%%x') popd config.txt (username/password file) var1= var2= Regards, Dave.
Hello, My constraints are: + Run a batch file using DOS (CMD). + Use a tool (.exe) that is able to encrypt a password, outside this batch (manually, in 1 shot) + Use the same tool that is able to decrypt the password, inside this batch) + In fact, the goal is to build several things (user account with this password, scheduled tasks.) using this batch. + We don't want that someone can read the password + We don't want that the technician need to write the password manually + We must run this batch inside several versions of Windows: XP, 2003, 2008 R2 64, 2012. + Then, with XP, without change, it's impossible to use PowerShell.
+ If a soluce exist with VBS, I can use it. Best regards, Cyril. Well, Due to the short delay, I plan to: Step 1: the build + use a txt file that contain the password + encrypt the txt file Step 2: the run (batch) + decrypt the txt file + read the file (type) into a second txt file (temporary) + call with FOR /F the second txt file, and read the password (as a variable) + use the variable to: build a new account and build the schedules tasks using the same login/password I come back to you. Now, how to use a good and strong tool to encrypt a txt file that contain the password? Regards, Cyril.