虽然我正在运行 Windows 7 64 位,但我有一个 vbs 文件需要以 32 位运行。 我可以用命令启动此文件
C:WindowsSysWOW64cscript.exe my-file.vbs
这很好,但它留给我一个多余的指令提示窗口, 我每次必须手动关闭它。 它也使得运行这个 vbs 文件作为启动项目非常麻烦 。
有办法在背景中启动我32位 vbs文件吗?
虽然我正在运行 Windows 7 64 位,但我有一个 vbs 文件需要以 32 位运行。 我可以用命令启动此文件
C:WindowsSysWOW64cscript.exe my-file.vbs
这很好,但它留给我一个多余的指令提示窗口, 我每次必须手动关闭它。 它也使得运行这个 vbs 文件作为启动项目非常麻烦 。
有办法在背景中启动我32位 vbs文件吗?
尝试一下 64bit 问题, 如果它有效, 您可以将它与其他答案结合起来 。
这里的问题更深入地涉及 32/ 64 位问题
< a href=" "https://stackoverflow.com/ questions/556283/how-do-i- check-i- check-if-wampn-campt-crent-runs-on-x64-host-os" "我如何检查 x64 主机OS 上是否有wscript/crpt 运行?
在此修改版本, 应该确保脚本在 64bit 平台上运行 。
On Error Resume Next
Dim WshShell, OsType
Set WshShell = CreateObject("WScript.Shell")
OsType = WshShell.RegRead("HKLMSYSTEMCurrentControlSetControlSession ManagerEnvironmentPROCESSOR_ARCHITECTURE")
If OsType = "x86" then
wscript.echo "Windows 32bit system detected"
else
wscript.echo "Windows 64bit system detected"
If InStr(LCase(WScript.FullName),"system32") Then
CreateObject("WScript.Shell").Run """%systemroot%SysWOW64wscript.exe"" """ & WScript.ScriptFullName & """"
Wscript.Quit
End If
end if
Msgbox("I ran..")
如果您需要使用标本, 这是IMHO 很酷的解决方案
Const HIDDEN_WINDOW = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "
ootcimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:\" & strComputer & "
ootcimv2:Win32_Process")
objProcess.Create "Cscript.exe h:ScriptTest1.vbs", null, objConfig, intProcessID
如果您可以使用下标, 您可以做以下操作, 它是最简单的方法 。
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Wscript.exe h:ScriptTest1.vbs"
实际上,您可以用单线( i m a Ruby guy 8> ) 来做它。
CreateObject("Wscript.Shell").Run("Wscript.exe h:ScriptTest1.vbs")
I ve been asked to help out with a project which has made extensive use of VBScript to process a whole bunch of text files and generate certain outputs - sanitized files, SQL entries etc.. The script ...
I have a lot of HTML pages that need the same few lines of text changed on them. To reduce the time it will take to manually open each one in Notepad and find the text and replace it with the new text,...
I am trying to call a method I have written in C# from VBScript. I have followed just about all of the instructions I can find on the web and am still having problems. Specifically I am getting Error:...
How to set delay in vbscript? WScript.Sleep(100) does not work on Windows XP, Vista.
I usually do C# but have inherited a classic ASP project. I have defined a class: Class clsPayment Public Name End Class Set objPayment = New clsPayment objPayment.Name = "...
I am working on a number of websites with files dating back to 2000. These sites have grown organically over time resulting in large numbers of orphaned web pages, include files, images, CSS files, ...
How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....
I am trying to query an .xls spreadsheet with VBScript, but I have run into an issue when trying to cast a field. I connect to the spreadsheet like this. Set objConnection = CreateObject("ADODB....