我正在使用在其他地方找到的批处理(如下)来方便地将文件移动到 USB 闪存驱动器上,但还想在此过程中重命名闪存驱动器。我如何在 Win10 中整合重命名部分?大多数搜索建议使用 Powershell,但我希望将整个过程包装在一个脚本中。
非常感谢任何能为我指明正确方向的建议或信息!
@echo off
cls
:start
set choice=
xcopy /e /y C:\Users\asimpson\Desktop\transfer\*.* E:
goto wait
:check
timeout /t 1 /nobreak >nul
echo waiting
if exist E: (goto start) else goto check
:wait
timeout /t 1 /nobreak >nul
echo Waiting for removal
if exist E: (goto wait) else goto removed
:removed
echo removed
goto check
答案1
标签命令就是您要找的。
请注意,您必须以管理员身份运行此程序。
c:\>label /?
Creates, changes, or deletes the volume label of a disk.
LABEL [drive:][label]
LABEL [/MP] [volume] [label]
drive: Specifies the drive letter of a drive.
label Specifies the label of the volume.
/MP Specifies that the volume should be treated as a
mount point or volume name.
volume Specifies the drive letter (followed by a colon),
mount point, or volume name. If volume name is specified,
the /MP flag is unnecessary.
所以:
C:\>label c: CeeDrive
C:\>dir c:
Volume in drive C is CeeDrive
Volume Serial Number is 7AAA-A01B