If the batch script run from USB drive then below command saves the text file to USB drive and folder batch script executed from.
Below command ask you to enter the USB drive letter and saves the text fie to USB drive
Code
@Echo Off & Cls
Tasklist > list.txtBelow command ask you to enter the USB drive letter and saves the text fie to USB drive
Code
@Echo Off
:Start
Cls
@Echo.
@Echo.
@Echo Please Enter the USB Drive Letter. (X) & Set /p DriveLetter=^>
If "%DriveLetter%"=="" Goto :Start
Tasklist > %DriveLetter:~0,1%:\List.txt