2 * LABEL.C - label internal command.
7 * 10-Dec-1998 (Eric Kohl)
10 * 11-Dec-1998 (Eric Kohl)
13 * 19-Jan-1998 (Eric Kohl)
16 * 28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
17 * Remove all hardcode string to En.rc
22 #ifdef INCLUDE_CMD_LABEL
25 INT
cmd_label (LPTSTR cmd
, LPTSTR param
)
27 TCHAR szRootPath
[] = _T("A:\\");
32 /* set empty label string */
33 szLabel
[0] = _T('\0');
38 if (!_tcsncmp (param
, _T("/?"), 2))
40 ConOutResPaging(TRUE
,STRING_LABEL_HELP1
);
45 if (param
[0] != _T('\0') && param
[1] == _T(':'))
47 szRootPath
[0] = toupper(*param
);
49 while (_istspace(*param
))
54 /* get label of current drive */
55 TCHAR szCurPath
[MAX_PATH
];
56 GetCurrentDirectory (MAX_PATH
, szCurPath
);
57 szRootPath
[0] = szCurPath
[0];
60 _tcsncpy (szLabel
, param
, 12);
63 if (!IsValidPathName (szRootPath
))
65 error_invalid_drive ();
70 GetVolumeInformation(szRootPath
, szOldLabel
, 80, &dwSerialNr
,
73 /* print drive info */
74 if (szOldLabel
[0] != _T('\0'))
76 ConOutResPrintf(STRING_LABEL_HELP2
, _totupper(szRootPath
[0]), szOldLabel
);
80 ConOutResPrintf(STRING_LABEL_HELP3
, _totupper(szRootPath
[0]));
83 /* print the volume serial number */
84 ConOutResPrintf(STRING_LABEL_HELP4
, HIWORD(dwSerialNr
), LOWORD(dwSerialNr
));
86 if (szLabel
[0] == _T('\0'))
88 ConOutResPuts(STRING_LABEL_HELP5
);
90 ConInString(szLabel
, 80);
93 SetVolumeLabel(szRootPath
, szLabel
);
98 #endif /* INCLUDE_CMD_LABEL */