Skip to main content
Solved

PASS VARIABLE UNDER BATCH FILE

  • April 15, 2025
  • 1 reply
  • 46 views

Forum|alt.badge.img+5

Hi Team,

i have a below script for encrypt the files ( saved the script file as CMD.bat )

 

@echo off
:: Navigate to the directory containing Encrypt_decrypt.exe
cd C:\PPK\Com

:: Set the TOTP code
set TOTP_CODE=99999

:: Create a temporary file with the TOTP code
echo %TOTP_CODE%> temp_input.txt

:: Provide the input file to the encryption command
Encrypt_decrypt.exe 9192939495 "D:\RPA\Temp\New file.zip" enc < temp_input.txt

:: Remove the temporary file
del temp_input.txt

pause

from above script i need pass the “99999” (which i can store in string) under parameter ( because the otp is dynamic),

How can i achieve this ?

 



 

Best answer by JLogan3o13

You may or may not already know that you can natively encrypt and decrypt files through AA (look in the PGP Package) so you can get away from using a .bat file. However, if you need to continue with this method, you could do something like what I have below. This works whether I input the number directly or from a variable.

 

BAT file:

:: Set the TOTP code
set TOTP_CODE=%1

 

Bot:

 

Result:

 

1 reply

Forum|alt.badge.img+17
  • Most Valuable Pathfinder
  • Answer
  • April 22, 2025

You may or may not already know that you can natively encrypt and decrypt files through AA (look in the PGP Package) so you can get away from using a .bat file. However, if you need to continue with this method, you could do something like what I have below. This works whether I input the number directly or from a variable.

 

BAT file:

:: Set the TOTP code
set TOTP_CODE=%1

 

Bot:

 

Result: