penpen wrote:SG-1 wrote:So was wondering if I can call the second batch from the first
Yes, you can:
Code: Select all
rem content of first.bat
call second.bat
SG-1 wrote:I was also wondering if from the first batch I can run an task that will run the second batch...
This is possible, too.
Code: Select all
rem content of first.bat
start "" second.bat
SG-1 wrote:My concern is that the second batch must run at "highest" parameters which is why I want to use a task to run the second batch
I'm not sure what you mean, maybe this:
Code: Select all
rem content of first.bat
start "" /REALTIME second.bat
penpen
Thank you penpen
I think call will work fine but will keep start in mind
My situation is that I have a large batch file that does a backup and restore but only needs the restore if what gets restored is gone, and it requires user interaction if restore is needed so it can't run silent
And so I wanted to split the batch file so that the backup part (1.bat) will be run silently with a task that has switches to run first batch file silently like I think this does
Code: Select all
schtasks /create /tn "Task1" /tr "%SystemDrive%\One\One1\1.bat" /sc onstart /ru ""
And if a restore is needed then the Restore part (2.bat) will be called by 1.bat
My question is when my first batch calls my second batch will it will run as administrator or another user or system level?
And I will use this call in 1.bat to call 2.bat
Also was wondering how to write this correctly regarding the
& goto exit part
Code: Select all
echo if %%errorlevel%%==0 call 2.bat & goto :Exit >>%SystemDrive%\One\One1\1.bat
After I call 2.bat I want 1.bat to close
Thank you
