How to rename a flash drive using matlab?

1 view (last 30 days)
Daniya Zafar
Daniya Zafar on 11 May 2022
Commented: Daniya Zafar on 11 May 2022
I want to create a GUI using MATLAB appdesigner in which I can rename a connected flash drive.
Current name: USB DISK (E:)
NEW name:Sam's Flash Drive
Any suggestions are much appreciated.

Accepted Answer

Jonas on 11 May 2022
this is possible via windows command line. You can access the windows command line via matlab using the system() command
system('label e: YourNewName')
Daniya Zafar
Daniya Zafar on 11 May 2022
I figured it out.
  1. concatenate strings using strcat
  2. convert the resulting string to char
driveLetter = char(strcat("label " , app.DriveLetterDropDown.Value," Sams FD")); % results in 'label E: Sams FD'
cmd = system(driveLetter);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by