How to install apps with adb shell and how to backup device settings and restore to an identical device? I am searching for days and I am really confused on what should I do and I decided to look for help here.

I have a rooted by default Android device (box) and I have changed some of the device settings (Date &amp; Time, security, accessibility, display, HDMI, MCU settings and developer Options).

Now I want to find a solution like an (APK or ADB shell or script) in order to copy or backup this settings and restore them to another identical device with the same firmware.

I have tried a lot of applications, but at almost every app that I have already tried, I have an issue with the touch options. (For example: I can't choose yes/no at some critical points)

Please, suggest me what to do. Every answer that can help me to find out a solution to this it could be useful!



Edit:

In order for you to understand my situation, I have already set up some devices with four apps and I have changed some of the settings of the device like I said before. I want to fully backup and restore  my device or write a script for this situation because I want to do the same set-up for 50+ devices, and for this I need some automation, but because the apps that I want to use want a different setup per device, until now I have decided to make the installation  with a usb. 

So at this moment I want somehow to copy the settings from one  device to another identical device. I can tell you some apps that I have tried but cannot work properly because of the touch options (CLONEit, Titanium Backup, Helium, G Cloud, Backup Your Mobile, Rom Settings Backup), except from apks I have tried Android SDK with adb shell, but the app can't copy all my settings, so I reject adb shell option (I tried every possible command). I have tried TWRP but I can't choose some options because of the touch options (I have tried keyboard with touchpad and mouse but nothing, some options are unable to be chosen).

I have tried more apps than I've mentioned, but the only app that did exactly what I want with the settings is "Rom Settings Backup", because it copy every setting of my device. If anyone of you have already used Rom Settings Backup Pro, I want you to tell me how can I restore the settings from my first device to another?

About the script, I have my apps saved as apk files. I am telling that because, I believe that somehow with a script I can make my device to install my apps. Also, if I can change some of the settings with a script it would be great. 

If anyone can guide me on what I have to do or what should I search for I would appreciate it because I am newbie at scripts.

I forgot to mention that I have got from an app an XML file with the device settings, but I don’t know what to do with it or how to restore that XML file on my device because the app that did the backup for me didn’t have an option for restore.
I want to share with you some tips from my research: 
On how to copy your device settings and your Apks from one device to another, but its only for ROOTED devices (in my case, I did that to identical Android devices without issues).

Tips:


First, you have to download and setup ADB (it’s not difficult search at google-youtube)
If you want to do this procedure for a lot devices, you can use a 7-port usb hub with switches(ON/OFF). ADB, for example, can’t execute commands simultaneously. If you want to save some time and don’t want to plug and unplug devices, you can use a hub like this in order to be able to choose in which device will the commands run.


1)How to copy almost every device setting?

At your 1st device:


Download ROM Settings Backup from Playstore.
Install it  and prepare your settings. Next, select a ROM 
(I test every ROM options and all were the same except if you create a new one. 
Do not create a new).
Just pick one from the existing ones and backup your settings.
(If you are using an Android box, use a keybboard and try arrows, Touchpad or mouse will not work).
Try to find the path, for example …/SettingsBackup/Backups/omniROM....
and copy the folder with your backup settings.


Save this file to your computer. Connect your 2nd android device to your computer [First you have to install “Rom Settings Backup” , then open command prompt and paste the following command but not exactly that, try find the path on your device(**). 

adb push yourbackupfoldername /storage/emulated/0/SettingsBackup/Backups

(**) Find the path that you will push your backup folder to your new device (if you cant find it , download "ES File Explorer File Manager" and you will figure out the exactly path)
If you want you can open Notepad > paste the command : 
adb push yourba.../… /Backups and save the file as settings.bat 
(When you double click the .bat file or if you type the command to cmd, the folder that you choose  will be copied to the right path at your new device).

Then open "ROM Settings Backup" at your 2nd device and Restore your backup.
At my device the timezone wasn't right and if it's not for you too, then  you have 2 options: 


You can change it manually from your device settings or 
Do the following: paste the command below to cmd or to a new bat file (your device will reboot after this command, so you can add this command to a new raw at your previous .bat file  or create a new .bat file).


adb shell "su -c 'setprop persist.sys.timezone Europe/Madrid; stop; sleep 5; start'"

2)How to install automatically with commands as many application you want ?

You can just paste at cmd:

adb install –r “Nameofyourapk1.apk”

and repeat this for every app
but it’s faster if you have a lot of devices to do the following:

First, download your applications as Apks from a trustworthy source.
Then copy them to a folder and create a new installapps.bat file (from Notepad) at the same folder and with the following commands:

adb install -r "Nameofyourapk1 .apk"
adb install -r "Nameofyourapk2 .apk"


Paste these commands, rename your .apk  name for every app that you want to copy. 
(Change raw for every new app.)

When you run installapps.bat file the apks will be automatically installed to your new device. Then continue and open these apps at your 2nd device in order to finish installation.

Do not hesitate for further information.