My output reads: Drives: C:\ D \ J:\ ( J:\ being my DVD drive. But the command fsutil fsinfo drives does. Note that this batch method does not identify DVD drives, not sure why. Set =A B C D E F G H I J K L M N O P Q R S T U V W X Y Zįor %%- in (%%) do if exist %%-: vol %%-: | find "in drive" Batch File echo Available Drives:įor %%v in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%v:\\" Here's my batch file which includes both for commands you can comment-out the for command that you do not want to run by prefixing command lines with two colons ( ::). Volume in drive C is OS Volume in drive D is DATA Next, select the disk for which you want to view the details. The results from the original identified all available drive letters mixed in with for command processing the full set of capital letters. Procedure From the Windows Command Prompt, type diskpart. The drive with Windows on it (usually C) will ask you to restart before CHKDSK can run. For example, to repair the D drive, enter chkdsk D: /f. I placed a pause command so that it wouldn't be necessary to run a "Command Prompt" beforehand in order to see the results when clicking on the batch file. To run CHKDSK on a different drive, type chkdsk drive letter: /f, replacing drive letter with the letter of the drive you want to scan. I piped the results to the external find command to filter serial number lines created by the vol command. The added command line off filtered the output to show results only. You will get a list of disks that are connected and each disk. You now need to list all the disks connected to your system with the command below. If you need to find the GUID for an external drive, connect it first. Type select disk disk number and press Enter. Open Command Prompt with admin rights and enter the following. Type diskpart.exe in the Run box and press Enter to open DiskPart command window. Testing the omission the two back slashes yields the same results. If you need to delete the OEM partition to free up a few gigabytes of space, then you can use Diskpart commands. Since if exist will be checking for drive letters only, there will never be a space character in this test, so I omitted the double quotes. I also used the set command to create the variable that would contain the full set of capital letters in order to shorten the for command's length. I wanted to share my batch edit/modification that based on cybercontroler's answer.įor my current project, I needed to identify which drive labeled as DATA so I replaced the echo command with vol (internal command). I absolutely love the pure batch method shown in the answer from cybercontroler, all internal commands no less!
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |