> For the complete documentation index, see [llms.txt](https://security.navidnaf.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://security.navidnaf.com/ollivanders/metasploit-framework/automating.md).

# Automating

Metasploit **resource scripts** are a helpful feature that lets you **automate repetitive tasks** and commands. They work like **batch scripts**, where you list a series of **msfconsole commands** to run one after the other. You can load these scripts in **msfconsole**, and it will automatically execute the commands in the script.

These scripts can be used to **automate tasks** such as setting up multi handlers or loading and running payloads. This makes the process quicker and easier.

{% code overflow="wrap" %}

```ruby
ls -al /usr/share/metasploit-framework/scripts/resource

# handler.rc
use multi/handler
set PAYLOAD windows/meterpreter/revers_tcp
set LHOST [IP]
set LPORT [PORT]
run

msfconsole -r handler.rc
or
resource [PATH TO RESOURCE SCRIPT]

makerc [SAVING PATH TO RESOURCE SCRIPT]
```

{% endcode %}
