| 1. |
Solve : Getting volume label name? |
|
Answer» Hello. Thanks for any help. I need some help in writing a batch dos command script that will check the name of the C: drive and if it does not match what I expect, will display a message. REASON is I have SEVERAL bootable harddrives in my system and when I boot up, I want to make sure I'm on the correct drive. Squashman's code will need a tweak if your label contains spaces. Code: [Select]for /F "tokens=5*" %%G in ('VOL C:') do set vol_label=%%HAnother method that works well is to put a FILE in the root with a unique filename and then check if that file exists. You can easily create a very small file with the command "echo > My_Disk". Not necessarily any better than using the VOLUME but simply an alternative.Quote from: strollin on September 09, 2015, 09:33:07 AM Another method that works well is to put a file in the root with a unique filename and then check if that file exists. You can easily create a very small file with the command "echo > My_Disk". Not necessarily any better than using the volume but simply an alternative.Yes. Definitely not the best alternative considering the security settings Microsoft puts in by default on the root of the C: drive now. Code: [Select]C:\>echo. >My_Disk Access is denied.I should have mentioned that you just need to do that from an Admin command prompt. |
|