This is a way to seriously extend the battery life of anything you can charge off of USB. It’s sort of like a giant minty boost, minus the mint.
After I built this, I discovered that Milwaukee already makes something that does just that, called a Power Port for their 12v lineup of power tools. Why not save $20 and build it into a tool you’ve already got? The 12v -> 5v USB adapter I used can handle up to 24v of input, so you could do this with your 18v tools as well. It also has a handy status LED, so you know when the power is switched to it.
12-24v battery operated power tool
Car cigarette USB adapter