For multiple commands from the address bar separate them with ampersand (&). eg
to display a dir listing of the left pane and then the right pane (I know it is a bit redundant from a dual pane X2
). Something more useful is
Code: Select all
$ "C:\Program Files\7-Zip\7z.exe" a "$R\Backup.7z" $S && del $S
This first calls 7Zip to create an archive called backup in the right pane folder, and if successful it then deletes the files added to the archive. The double ampersand (&&) is important. Commands following a single & will always run, those following a double && will only run if the previous command did not generate an error. If using redirection the comand and redirection have to be wrapped in brackets. You can also group commands with brackets so the whole group only run if the previous one worked.
Putting that all together, the following will prompt the user for the archive filename (using X2 token $?), redirect the 7Zip command output to a log file, then (if 7Zip didn't error) report files archived and delete those files, and finally report done (regardless of 7Zip exit status).
Code: Select all
$ ("C:\Program Files\7-Zip\7z.exe" a "$R\$?.7z" $S > log.txt) && (echo These files were archived: & echo $S & del $S) & echo Done!
|| is opposite of &&, it will run the following command if the previous command did error. I don't think there is anyway to combine && and || to get an if else type structure.
More info about these symbols is at
http://ss64.com/nt/syntax-redirection.html.
Same can be used in user commands.