Run one or more scripts in sequence. Supplied with Windows 10 (1607+).

         -appvscript scriptFileName [Arguments]
            [-appvscriptRunnerParameters [-wait] [-timeout=TimeInSeconds] [-rollbackOnError]]
         -appvscript scriptFileName [Arguments]
            [-appvscriptRunnerParameters [-wait] [-timeout=TimeInSeconds] [-rollbackOnError]]

   -appvscript  The script to be executed: PowerShell (.ps1), VBScript (.vbs), executable(.exe), Batch (.bat).
                Multiple scripts may be run by including multiple -appvscript options.
                ScriptRunner will run any script whose file type is associated with an application installed
                on the computer.
                If the associated application is missing, or the script’s file type isn't associated with any
                of the computer's applications, the script won't run.
                An alternative is to call powershell.exe or CMD.exe and pass the script name as an argument.

   Arguments    Any arguments for the script being run.

      -wait            Wait for this script to complete before continuing.
      -timeout         Timeout after TimeInSeconds seconds and continue.
      -rollbackOnError Rollback if the script exits with a non zero exit code.
                       If -rollbackOnError is set, then by implication -wait will also be True.

Default values for -appvscriptRunnerParameters: No wait, No timeout, No rollback on error.

Every parameter must be separated by a space character.

The rollback on error is limited in its effect, if the script creates a new output file, then rollback will delete the file, but if the script updates or replaces an existing file then rollback will not revert those changes.
If a ScriptRunner command contains more than one -appvscript clause, then rollback on error may fail to work for either script.

You can use ScriptRunner in DeploymentConfig.xml, UserConfig.xml and AppxManifest.xml files (all trigger events).


Demonstrate the timeout by running a pause command:

ScriptRunner.exe -appvscript cmd "/c" "pause" -appvscriptrunnerparameters -wait -timeout=20

Run two scripts passing parameters to each (this is all one line):

ScriptRunner.exe -appvscript demoA.cmd arg1 arg2 -appvscriptrunnerparameters -wait -timeout=30 -rollbackonerror -appvscript demoB.ps1 arg3 arg4 -appvscriptrunnerparameters -wait -timeout=30 -rollbackonerror

   -appvscript script1.exe arg1 arg2 –appvscriptrunnerparameters –wait –timeout=10
   -appvscript script2.vbs arg1 arg2
   -appvscript script3.cmd arg1 arg2 –appvscriptrunnerparameters –wait –timeout=30 –rollbackonerror
   <Wait timeout="40" RollbackOnError="true"/>

"He can run. But he can’t hide" ~ Joe Louis, 1946

Related commands

START - Start a program, command or batch file.
Run a script - How to create and run a batch file.
Equivalent PowerShell: Run a script How to run a .ps1 script by calling PowerShell.exe
Equivalent bash command (Linux): Run a bash shell script

Copyright © 1999-2023
Some rights reserved