TCLSH and macros can be used on Cisco routers and switches to automate pinging multiple IP addresses to check connectivity. TCLSH scripts use a foreach loop to ping each IP address returned from show commands like show ip alias or show ip interface brief. Macros can also be used on switches that do not support TCLSH by creating a macro that executes multiple ping commands in the global configuration. Both methods ping multiple addresses without needing to manually ping each one.