我需要从我的安装中禁用windows-update服务.我已经使用vbscript做了一些事情,所以我想在vbscript中做.
我对vbscript(或任何其他脚本语言)的了解非常有限,所以有人可以帮我解决这个问题吗?我真的很感激!
谢谢.
我在VBScript中有一个我想要运行的一维数组,但是能够在循环的每次迭代中前进2,3,4等.在C中,这将是微不足道的......
for (int i = 0; i < 10; i+= 2)
Run Code Online (Sandbox Code Playgroud) 我想找到关键的"设备参数" HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE.
但是,它BD/DVD/CD ROM/Writers在每个系统中都有不同的关键.我的目前是HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE\CdRomHL-DT-ST_DVDRAM_GH20NS15________________IL00____\5&15602d3e&0&0.1.0\Device Parameters.
但我想搜索IDE下的每个子项BD/DVD/CD ROM/Writers以获取设备参数.有一个二进制值DefaultDVDregion,我想为每个值设置为0 BD/DVD/CD ROM/Writers.
我想在VBScript中这样做.
我正在使用vbscript编写脚本,我希望它在x分钟后自行终止.
我想的是抓住脚本启动时的时间,然后将整个事情保持在一个循环中,直到时间是开始时间后的x分钟,但我需要它继续检查后台,而不是等到循环完成.
我想要一条消息或某些东西通知用户他们花了太长时间,我可以自己做.
有没有办法在后台跟踪时间,还是有点确定它的过程?
我在这个StackOverFlow问题,VBScript中的对象/类的字典中找到了这段代码.
我的问题是为什么这个"短"课与这个"长"课做同样的事情?为什么甚至打扰长码?短类版本可以与同一类中的其他方法一起使用吗?谢谢!
短班
Class employeeclass
Public first, last, salary
End Class
Run Code Online (Sandbox Code Playgroud)
长班
Class employeeclass
Private m_first
Private m_last
Private m_salary
Public Property Get first
first = m_first
End Property
Public Property Let first(value)
m_first = value
End Property
Public Property Get last
last = m_last
End Property
Public Property Let last(value)
m_last = value
End Property
Public Property Get salary
salary = m_salary
End Property
Public Property Let salary(value)
m_salary = value
End Property
End Class
Run Code Online (Sandbox Code Playgroud)
但是,使用短类的完整脚本,只需用long类替换短类就可以获得相同的结果.
Class …Run Code Online (Sandbox Code Playgroud) 我是业余的VB脚本编写者.我正在制作一个脚本来检查是否存在两个文件中的一个,如果存在,则给出一个标记为"已安装"的标记.如果两个文件都不存在,则标记"未安装".这是我的剧本......
Option Explicit
DIM fso
Set fso = CreateObject("Scripting.FileSystemObject")
CreateObject("WScript.Shell")
If (fso.FileExists("C:\Program Files (x86)\Dell\KACE\AMPAgent.exe")) OR (fso.FileExists("C:\Program Files\Dell\KACE\AMPAgent.exe")) Then
WScript.Echo("Installed")
WScript.Quit()
Else
WScript.Echo("Not Installed")
WScript.Quit()
End If
Run Code Online (Sandbox Code Playgroud)
它在Windows 7中运行时有效.当我将其添加到BGInfo时,它会抛出此错误...
评估脚本字段'KACE'时出错
Microsoft VBScript运行时错误
第7行,第2位
变量未定义:'WScript'
[好]
我想我只需要一种方法来定义或调用WScript来执行,因为它显然不是通过BGInfo自行完成的,而我所做的并不起作用.我还没有看到任何有关StackOverflow上这个特殊问题的帮助.
有什么想法吗?
我有一个功能(见下文),它完美地工作.我最近将我的代码移动到另一台服务器,我没有更改任何内容.它无法在新服务器上运行.
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Mid'
/calculate.asp, line 416
Run Code Online (Sandbox Code Playgroud)
当我检查416行时,我得到了这个:
Dim result3: result3 = Mid(o3.responseText, Basla3, Bitir3)
Run Code Online (Sandbox Code Playgroud)
这是完整的功能:
<%
Function xyz()
Dim o3: Set o3 = Server.CreateObject("MSXML2.ServerXMLHTTP")
Dim o_date3: o_date3 = split(EndingDate, ".")
Dim s_date3
If (Len(o_date3(2)) = 4) Then
s_date3 = o_date3(2)
Else
s_date3 = "20" & o_date3(2)
End If
If (Len(o_date3(1)) = 2) Then
s_date3 = s_date3 & o_date3(1)
Else
s_date3 = s_date3 & "0" & o_date3(1)
End If
If (Len(o_date3(0)) = …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个脚本来将网络打印机连接到用户计算机.该脚本使用需要打印机作为参数的计算机名称.
打印机名称与其打印服务器名称相似,例如.server_USA有打印机,如printer_USA01,printer_USA02.
但是当它到达第一个时,它会抛出错误"Sub或Function not defined"...为什么?
Set shl = WScript.CreateObject("WScript.Shell")
strName = Wscript.Arguments.Item(0)
'input Printer name
strPrinter = InputBox("Please enter share name of printer to install:", _
"Add network printer")
if strPrinter = "" then
msgbox "Can't be empty."
WScript.quit
elseif strPrinter Like "printer_USA*" then
strServer = server_USA
elseif strPrinter Like "printer_SPAIN*" then
strServer = server_SPAIN
else
'Printer name NOT registered, input printserver manually:
strServer = inputbox("Please enter the name of the printserver","printserver")
if strServer = "" then
msgbox "Can't be …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照程序员的方式将HP Unified Functional Testing中的测试放在一起.对于那些不知道的人,该工具使用VBScript作为其驱动程序.
因为我想在多个UFT操作中使用来自相同DataTable的数据 - 并且因为Global表上已经有一组不同的数据 - 我想从外部文件中检索数据.UFT很乐意支持这个功能.
我目前的计划是,根据我正在运行的测试,我将遍历该表中的一系列行.
这是我提出的脚本:
' targets the local sheet, but
' not the same value as dtLocalSheet
Const sheetNum = 2
dim sheetRowCount
DataTable.ImportSheet "PersonFile.xlsx", 1, sheetNum
sheetRowCount = DataTable.GetSheet(sheetNum).GetRowCount
dim firstRow, lastRow
firstRow = Parameter("FirstPersonIndex")
lastRow = Parameter("LastPersonIndex")
If sheetRowCount < lastRow Then
lastRow = sheetRowCount
End If
If sheetRowCount >= firstRow Then
Dim i
For i = firstRow To lastRow
DataTable.SetCurrentRow i
' begin payload
MsgBox(DataTable.Value("LastName", dtLocalSheet))
' end payload
Next …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个简短的VBScript,它会打开"calc.exe"和"wordpad.exe".好吧问题是VBScript不会让我打开"wordpad.exe".我试图以管理员身份运行脚本,但这没有帮助.
我的脚本看起来像这样:
Set WshShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run "C:\Program Files\Windows NT\Accessories\wordpad.exe"
WSHShell.Run "C:\Windows\System32\calc.exe"
x=msgbox("Test",4096,Test)
Run Code Online (Sandbox Code Playgroud)
我也试过定义这样的路径:
WSHShell.Run ""C:\Program Files\Windows NT\Accessories\wordpad.exe""
Run Code Online (Sandbox Code Playgroud)
也行不通.我收到的消息是"预期结束声明"
是否有解决方案通过其路径打开"wordpad.exe"?
亲切的问候