gpt4 book ai didi

batch-file - 调用可移动驱动器中的 vbs 文件运行

转载 作者:行者123 更新时间:2023-12-04 00:27:40 24 4
gpt4 key购买 nike

我需要一些关于指定安装可移动磁盘路径的解释。我的批号...

wmic LOGICALDISK where driveType=2 get deviceID > "C:\Windows\Temp\wmic.txt" 
cls
for /f "skip=1" %%b IN ('type C:\Windows\Temp\wmic.txt') DO (xcopy JKDClean.bat %%b /Y)
for /f "skip=1" %%b IN ('type C:\Windows\Temp\wmic.txt') DO (xcopy run.vbs %%b /Y)
echo -----
echo Cleaning removable disk
for /f "skip=1" %%b IN ('type C:\Windows\Temp\wmic.txt') DO (wscript %%b\run.vbs)
TIMEOUT /T 10 /NOBREAK
echo DONE!!!
echo -----
for /f "skip=1" %%b IN ('type C:\Windows\Temp\wmic.txt') DO (del /s /q /f %%b\*.inf)
Del C:\Windows\Temp\wmic.txt
echo -----
echo DONE!!!
pause

第 4 行“xcopy JKDClean.bat %%b”路径运行得更好。但我无法运行该 vbs 文件“wscript %%b\run.vbs”。我需要该 vbs 文件在可移动驱动器中运行。如何指定当前可移动磁盘的路径???

最佳答案

为什么有这么多 for 循环:

@Echo Off
For /F "Skip=1" %%I In ('WMIC LogicalDisk Where DriveType^=2 Get DeviceID'
) Do (For %%J In (%%I) Do (Echo=Copy file.ext %%I & Echo=Copy file2.ext %%I
Echo=run %%I\file2.ext & Echo=Del/S/Q %%I\*.ext2))
Echo( Done & Timeout -1

注意您确实意识到一些内部使用的驱动器可以被视为可移动的,您的代码不仅仅适用于 USB 拇指/闪存驱动器!

关于batch-file - 调用可移动驱动器中的 vbs 文件运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39523109/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com