Please take this script into context with my question:
If objFSO.FileExists("C:\Windows\Fonts\" & objFile.Name) Then
Wscript.Echo "Font already installed: " & objFile.Name
I want a VBS script to quit/exit/terminate if X file already exists. Currently, it will instead give a message box saying "Font Already Installed" as expected.
If I remove the Echo
I instead get a blank box, where I still have to hit OK.
I want the script to just automatically end if X already exists with 0 user input.
Is this possible? I have wscript.quit
and wscript.exit
but just get errors.
The full script can be found here:
http://www.cloudtec.ch/blog/tech/install-font-command-line-script-windows-7.html
So again, in context, I want XYZ fonts to install. If they're already installed I want the script to just simply terminate without the need to hit OK. The intention is to deploy fonts accross a network.
Using Do While or Do Until allows you to stop execution of the loop using Exit Do instead of using trickery with your loop condition to maintain the While ... Wend syntax. I would recommend using that instead.
Syntax: WScript.Quit ([lngExitCode]) lngExitCode. Receives the code to be returned by the program upon exit. The Quit method causes the current script to terminate and return the specified exit code.
Echo. The Echo method displays parameters in a window (in Wscript.exe) or in a Command Prompt window (in Cscript.exe). Parameters are delimited by one space. Under Cscript.exe, this method outputs a carriage-return/line feed pair (CR LF) after the last parameter displayed.
Try this:
If objFSO.FileExists("C:\Windows\Fonts\" & objFile.Name) Then
WScript.Quit
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With