Calling VBS

I'm not too sure where the following is going wrong. For now I'm just trying to get the first button to work. Any ideas?


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





Public Sub Copier3()
Set objWSH = CreateObject("WScript.Shell")
strCMD = "cscript.exe C:PMPCopier3.vbs"
objWSH.Run(strCMD)

End Sub



Untitled Page















 

 














VBS:

strPrinter="\servercopier3"
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = CreateObject("WScript.Shell")
WshNetwork.AddWindowsPrinterConnection strPrinter
WshNetwork.SetDefaultPrinter strPrinter

MsgBox strPrinter & " Printer connected and set as the default printer"
Set WshNetwork = WScript.CreateObject("WScript.Network")




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories