Vbscript 替换现有文件或自动接受“是”

Vbscript 替换现有文件或自动接受“是”,vbscript,Vbscript,我对脚本编写相当陌生。我必须为100多台计算机部署字体。我为一个脚本设置字体,在没有字体的机器上可以正常工作。但是如果有字体,它会提示点击YES/NO来替换该字体。我正在尝试部署18种字体。我没有任何方法可以在没有提示的情况下替换现有字体,或者直接将“是”作为输入。 我找到的脚本是 `Option Explicit Dim objShell, objFSO, wshShell Dim strFontSourcePath, objFolder, objFont, objNameSpace, obj

我对脚本编写相当陌生。我必须为100多台计算机部署字体。我为一个脚本设置字体,在没有字体的机器上可以正常工作。但是如果有字体,它会提示点击YES/NO来替换该字体。我正在尝试部署18种字体。我没有任何方法可以在没有提示的情况下替换现有字体,或者直接将“是”作为输入。 我找到的脚本是

`Option Explicit
Dim objShell, objFSO, wshShell
Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile

Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = createobject("Scripting.Filesystemobject")

strFontSourcePath = "\\it\Deployments\(Dell setup)\Office fonts\FILES\Maison Neue MG [DESK]"

If objFSO.FolderExists(strFontSourcePath) Then

Set objNameSpace = objShell.Namespace(strFontSourcePath)
Set objFolder = objFSO.getFolder(strFontSourcePath)

For Each objFile In objFolder.files

    If LCase(right(objFile,4)) = ".ttf" OR LCase(right(objFile,4)) = ".otf" Then
            If objFSO.FileExists(wshShell.SpecialFolders("Fonts") & objFile.Name) = False Then
                Set objFont = objNameSpace.ParseName(objFile.Name)
                objFont.InvokeVerb("Install")

                Set objFont = Nothing
            End If
        End If
    Next
Else
    Wscript.Echo "Path not found"

End If

Wscript.Echo "Installation Complete :)"`
查看他们基本上在哪里手动复制和添加到注册表。您可以使用/y开关进行复制以覆盖。