Fortunately, Visual Studio Code has a little terminal you can use to run commands without needing to swap between windows.
This VS Code extension provides support for the R programming language, including features such as R language service based on code analysis, interacting with R terminals, viewing data, plots, ...
This example shows how you can use this library to download chromedriver binary and use it immediately. The chromedriver will be downloaded to base directory.