command prompt to format a usb drive code example
Example: clean pendrive using diskpart
//Windows
1) Open Start
2) Enter:diskpart
3) Enter:list disk
4) Enter:select disk *number*
5) Enter:clean
6) Enter:lisk disk
7) Enter:create partition primary
8) Enter:select partition 1
9) Enter: active
10) Enter:format FS=NTFS label=Diskname quick //quick is optional if you dont have bad sectors
11) Enter:assign letter=g