The Windows Security app can start a scan, but it takes a few clicks, and you cannot script a click. The Defender module has a cmdlet for it.
Start-MpScan -ScanType QuickScan
The -ScanType parameter accepts QuickScan, FullScan and CustomScan. Without any parameter, Start-MpScan starts a scan on the computer you run it on, as the documentation’s only example shows.
To scan one folder, give it a path:
Start-MpScan -ScanType CustomScan -ScanPath C:\Users\Public\Downloads
The documentation says -ScanPath takes a file name, a folder name or a UNC path. The page does not spell out how -ScanPath combines with the scan types, so check the result on your own machine.
A full scan takes a long time. The -AsJob switch runs the cmdlet as a background job, so you get your prompt back. You then manage it with the *-Job cmdlets, and Receive-Job gets the result:
$job = Start-MpScan -ScanType FullScan -AsJob
Get-Job $job.Id
Receive-Job $job.Id
One caveat: the documentation for this cmdlet does not describe what the scan prints or how it reports threats, so check the Windows Security app afterwards for the outcome. It also does not state whether an elevated prompt is required, so start PowerShell as administrator if the cmdlet complains about access.
None of this was run on a live Windows machine here. It follows the Microsoft documentation.
Further reading: Start-MpScan