|
本帖最后由 窄口牛 于 2025-10-1 22:14 编辑
搞了个vhd放ntQQ,只读挂载vhd,运行QQ,退出QQ以后,自动卸载vhd。
- Set objShell = CreateObject("WScript.Shell")
- Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
- vhdPath = "D:\Program Files\NTQQ\ntqq.vhd"
- mountPoint = "W:"
- objShell.Run "diskpart /s ""%temp%\mountvhd.txt""", 0, True
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objFile = objFSO.CreateTextFile(objShell.ExpandEnvironmentStrings("%temp%\mountvhd.txt"), True)
- objFile.WriteLine "select vdisk file=""" & vhdPath & """"
- objFile.WriteLine "attach vdisk readonly"
- objFile.WriteLine "sel par 1"
- objFile.WriteLine "assign letter="& Left(mountPoint, 1)
- objFile.Close
- objShell.Run "diskpart /s ""%temp%\mountvhd.txt""", 0, True
- qqPath = mountPoint & "QQ.exe"
- objShell.run """" & qqPath & """ --user-data-dir=W:\Data", 1, True
- Set objFile = objFSO.CreateTextFile(objShell.ExpandEnvironmentStrings("%temp%\dismountvhd.txt"), True)
- objFile.WriteLine "select vdisk file=""" & vhdPath & """"
- objFile.WriteLine "detach vdisk"
- objFile.Close
- objShell.Run "diskpart /s ""%temp%\dismountvhd.txt""", 0, True
- objFSO.DeleteFile objShell.ExpandEnvironmentStrings("%temp%\mountvhd.txt"), True
- objFSO.DeleteFile objShell.ExpandEnvironmentStrings("%temp%\dismountvhd.txt"), True
复制代码 目的是阻止其自动下载新的版本。
|
|