I'm trying to replace some text in a .yml
file using batch.
My code:
@echo off
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
setlocal enableextensions
set jruby="%~dp0jruby\bin\jruby"
set someDir="%~dp0..\test\test2"
cd %someDir%
copy /y file.yml test_file.yml > NUL
for /f "tokens=2*" %%i in (file.yml) do @set "password=%%i"
echo Your password --- %password% --- will now be encrypted due to security reasons...
%jruby% -S run_file.rb
for /f "delims=" %%x in (some_file.rb) do set some_key=%%x
FOR /F "tokens=* USEBACKQ" %%F IN (`%jruby% -S encrypt_property_for_yaml encrypt %some_key% %password%`) DO (
SET encrypted_pw=%%F
)
echo Random 32-Bit encryption key created: %some_key%
echo Password was encrypted to: %encrypted_pw%
echo.
echo Encrypted password will be saved in file.yml file...
set "replace=%encrypted_pw%"
set "databaseFile=file.yml"
set "search=%password%"
for /f "delims=" %%i in ('type "