::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: File Name: key_copy.bat :: :: Version: 1.01 :: :: Description: :: Simple script to copy generated key files to a persistent location :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Copyright 2017-2018, Cypress Semiconductor Corporation. All rights reserved. :: This software is owned by Cypress Semiconductor Corporation and is protected :: by and subject to worldwide patent and copyright laws and treaties. :: Therefore, you may use this software only as provided in the license agreement :: accompanying the software package from which you obtained this software. :: CYPRESS AND ITS SUPPLIERS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, :: WITH REGARD TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, :: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off set OUT_DIR="..\Keys" set LOCAL_DIR=keys_generated set SRC_PRIV_NAME=rsa_private_generated.txt set SRC_PUB_NAME=rsa_public_generated.txt set SRC_AES_NAME=aes_private_generated.txt set SRC_EIV_NAME=aes_eiv_generated.txt set PRIV_NAME=rsa_private.txt set PUB_NAME=rsa_public.txt set AES_NAME=aes_private.txt set EIV_NAME=aes_eiv.txt :: File Check set ALLOK=1 IF NOT EXIST %LOCAL_DIR%\%SRC_PRIV_NAME% ( echo File %SRC_PRIV_NAME% does not exist. set ALLOK=0 ) IF NOT EXIST %LOCAL_DIR%\%SRC_PUB_NAME% ( echo File %SRC_PUB_NAME% does not exist. set ALLOK=0 ) IF NOT EXIST %LOCAL_DIR%\%SRC_AES_NAME% ( echo File %SRC_AES_NAME% does not exist. set ALLOK=0 ) IF NOT EXIST %LOCAL_DIR%\%SRC_EIV_NAME% ( echo File %SRC_EIV_NAME% does not exist. set ALLOK=0 ) IF %ALLOK% == 0 ( echo Please run the keygen batch file to generate the keys. echo. goto :end ) IF NOT EXIST %OUT_DIR% mkdir %OUT_DIR% :choice cls echo Warning: The keys used in the application will be overwritten. set /P c=Are you sure you want to continue [Y/N]? if /I "%c%" EQU "Y" goto :cont if /I "%c%" EQU "N" goto :end goto :choice :: Copy files to persistent location, renaming them in the process :cont COPY /y %LOCAL_DIR%\%SRC_PRIV_NAME% %OUT_DIR%\%PRIV_NAME% COPY /y %LOCAL_DIR%\%SRC_PUB_NAME% %OUT_DIR%\%PUB_NAME% COPY /y %LOCAL_DIR%\%SRC_AES_NAME% %OUT_DIR%\%AES_NAME% COPY /y %LOCAL_DIR%\%SRC_EIV_NAME% %OUT_DIR%\%EIV_NAME% :end pause