I'm try to improving this and make it looks better. I have two issues
When I run as administrator the file that I need won't copy in the user profile (I just run as admin to run the .bat script.
When I open the software I need it to close the process and reopen it again, but the script run but commands without waiting the first one to be finished.
:: ---Don't print commands@echo off:: ---Close AnyConnecttaskkill /F /IM vpnagent.exe /IM vpnui.exe:: ----Add the file.xml" file to locationxcopy %~dp0"file.xml" "C:\ProgramData\location\" /S /Q /Y /F:: ----Print a wait notificationecho Installation in progress...echo Please wait, may take a while:: -----Install "software.exe"%~dp0software /Silent:: ----Open softwarestart /d "C:\Program Files (x86)\Location" test.exePause:: ----Close sofwaretaskkill /F /IM software.exe:: ----Copy the "Test" and "Test2" to "C:\Users\[[userid]\AppData\Roaming\location\"xcopy %~dp0"test.xml" "%userprofile%\AppData\Roaming\Location\" /S /Q /Y /Fxcopy %~dp0"test2.xml" "%userprofile%\AppData\Roaming\Location\" /S /Q /Y /F:: ----Reopen softwarestart /d "C:\Program Files (x86)\Location" test.exe:: ----Finish the processexit