2016-03-08 45 views
0

當前每次將其放入另一個系統時,都會將閃存映射到閃存驅動器。之後驅動器關閉並且蝙蝠未完成執行。BAT更改分配的驅動器號,將驅動器的內容複製到C:然後關閉程序C:

我寫的腳本工作正常,但我必須運行批處理一次以分配指定的字母,然後再次運行它來完成字母分配後的其餘任務。

我所試圖做的是閃存驅動器到C的副本內容:(我用MD創建的文件夾)

然後執行,我只是複製過來的文件。

這是我到目前爲止。只是想完成這個操作,以便在多個客戶端之間自動執行更新過程。

FOR/F 「令牌= 2,3 delims =」 %%甲在( '回波列表體積^ | DISKPART^| FINDSTR 「PC設置工具」')做( 組Acedrive = %%乙 (回波選擇卷%%甲 回波分配信= P)| DISKPART )

MKDIR C:\ dellutil

XCOPY 「P:\ BIOS和驅動程序更新實用\ SourceFiles」 「C:\ dellutil」

regedit.exe /sc:\dellutil\runonceLaunch3.reg

管理-bde.exe -protectors -disable C:

「C:\ dellutil \ DellCommandUtility.EXE」

回答

0

爲什麼你不能在你的批處理文件中的閃存驅動器上使用下面的代碼?

@echo off 
rem Make directory of batch file the current directory. 
pushd "%~dp0" 

rem Copy files from directory "BIOS and Driver Update Utility\SourceFiles" 
rem of current drive - the drive of the batch file - to C:\DellUtil whereby 
rem XCOPY automatically creates the directory if not already existing. 
rem A relative path starting with a backslash is relative to root of 
rem current drive. 
xcopy "\BIOS and Driver Update Utility\SourceFiles" "C:\DellUtil\" /H /I /Q /R /Y 

regedit.exe /s C:\DellUtil\runonceLaunch3.reg 
Manage-bde.exe -protectors -disable c: 
"C:\DellUtil\DellCommandUtility.exe" 

rem Restore previous current directory. 
popd 

這絕對不是改變字母的閃存驅動器如果另一個驅動器早已字母P.

可總是失敗更容易也有美好的舊命令SUBST 。有關此命令的詳細信息,請在命令提示符窗口subst /?中運行。

+0

這太棒了。完美工作。我非常感謝你。我現在覺得很蠢。再次感謝。 –

相關問題