S
S
samokiller2022-03-10 19:11:56
Command line
samokiller, 2022-03-10 19:11:56

How to automate rar.exe continuation confirmation in console?

On disk D: there is a 1Tb sql database.
I regularly make a database dump archive on the C: drive.
The dump archive is larger than the C drive: therefore (and for a number of other reasons) I split the archive into 1Gb volumes.

Archiving occurs through a bat file:

"c:\program files\winrar\rar.exe" a -dh -v1G -k -vp -ag -m5 -r -s "c:/sqlBackup/" "d:\sqlServer\unbelievableBigFile.sql"

The -vp switch is responsible for ensuring that after each volume is created, the program asks for confirmation to continue working.

The second process is supposed to work in powershell, which monitors the appearance of new files in the backup folder. And as soon as they appear - uploads them to the Internet. And what unloaded - deletes, freeing up space for new ones.
Archiving is much faster than the process of uploading backups to the Internet, so you need to slow down the creation of the next volume.
It is planned that if the remaining free space on drive C: is less than 5 Gb, the archiving process is suspended until the files are uploaded to the Internet and free up space for new volumes.

In the console, it looks like this:
622a1f5e754a3011255047.jpeg

To create the next volume, you need to press "Y", and then ENTER.

How to automate pressing these keys? It is understood that before pressing these keys it will be necessary to check the amount of free space on the C drive:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2022-03-10
@rPman

echo y | rar.exe ....
if you need many times, then either create an application (2 lines in almost any programming language) that displays infinitely Y or a text file with a bunch of lines with Y
rar.exe ... < имя файла с Y

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question