wsh

JScript: how to run external command and get output?

痞子三分冷 提交于 2020-01-02 04:06:05
问题 I'm running my JScript file using cscript.exe. In the script I need to call an external console command and get the output. Tried: var oShell = WScript.CreateObject("WScript.Shell"); var oExec = oShell.Exec('cmd /c dir'); WScript.Echo("Status "+oExec.Status); WScript.Echo("ProcessID "+oExec.ProcessID); WScript.Echo("ExitCode "+oExec.ExitCode); and var oShell = WScript.CreateObject("WScript.Shell"); var ret = oShell.Run('cmd /c dir', 1 /* SW_SHOWNORMAL */, true /* bWaitOnReturn */); WScript

Is there a way to run a command line command from JScript (not javascript) in Windows Scripting Host (WSH) cscript.exe?

孤人 提交于 2020-01-01 05:36:47
问题 I'm writing a JScript program which is run in cscript.exe. Is it possible to run a commnad line command from within the script. It would really make the job easy, as I can run certain commands instead of writing more code in jscript to do the same thing. For example: In order to wait for a keypress for 10 seconds, I could straight away use the timeout command timeout /t 10 Implementing this in jscript means more work. btw, I'm on Vista and WSH v5.7 any ideas? thanx! 回答1: You can execute DOS

Automatically close MsgBox in vbscript?

巧了我就是萌 提交于 2019-12-30 07:27:31
问题 I am using VBScript to code some automation on excel. I have a MsgBox() within the code, and am looking for a way to close the pop-up window created by MsgBox() automatically without human intervention. Program execution would continue from there. 回答1: My comment has provided you tips to search and find out feasible answers. However to save your time, here is some insights. This post shows how you may manupulate MSGBOX in VB. Here is the best possible way anyone could think of in terms of VBA

Getting ActivePython to work with WSH

断了今生、忘了曾经 提交于 2019-12-30 04:33:30
问题 I've installed ActivePython 2.7.2 and I'm trying to execute a .pys script via the console with wscript/cscript, [i.e. ActivePython (PythonScript with .pys extension) in Microsoft's WSH(Windows Scripting Host)] and when trying with wscript I get two errors. "The program cannot start because MSVCR90.dll is missing from your computer try reinstalling the program to fix this problem" "Can't find script engine Python for script I did some googling and have also downloaded and installed the

How To Stop Wscript Exe

蹲街弑〆低调 提交于 2019-12-29 09:34:23
问题 I want to shutdown QTP which is invoked through Wscript.exe. 回答1: I used these three commands and it works perfectly fine. TASKKILL /F /FI "USERNAME eq Ankita" /IM wscript.exe" TASKKILL /F /im QTAutomationAgent.exe TASKKILL /F /im QTPro.exe 回答2: You cannot create multiple instances of QuickTest Application on a single machine. Even though you say CreateObject("QuickTest.Application") 10 times, all will be holding same instance of the application. Closing the quickTest using API method

Display a message box with a timeout value

[亡魂溺海] 提交于 2019-12-28 13:57:06
问题 The question comes from code like this. Set scriptshell = CreateObject("wscript.shell") Const TIMEOUT_IN_SECS = 60 Select Case scriptshell.popup("Yes or No? leaving this window for 1 min is the same as clicking Yes.", TIMEOUT_IN_SECS, "popup window", vbYesNo + vbQuestion) Case vbYes Call MethodFoo Case -1 Call MethodFoo End Select This is a simple way to display a message box with a timeout from VBA (or VB6). In Excel 2007 (apparently also happens in Internet Explorer at times) the popup

What is the difference between CreateObject and Wscript.CreateObject?

馋奶兔 提交于 2019-12-28 13:44:30
问题 Does anyone know the reasoning behind having the option using: Wscript.CreateObject("some.object") and CreateObject("some.object") within VBScript? when I find documentation or examples that use Wscript.CreateObject , I usually rewrite using CreateObject , because it always seems to work, and then I can easily reuse the code within an HTA or ASP. But I've always wondered why this feature existed and if what difference it makes if you use one way or another within VBScript. 回答1: There's no

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

独自空忆成欢 提交于 2019-12-27 10:39:10
问题 I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window displayed, with all arguments passed to the invisible batch. The first batch is executed in a console window. However, I do not want the second batch (launched by the first in a asynchronous way ) to also display a console window. I have come up with a VBScript script which does just that, and I put

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

吃可爱长大的小学妹 提交于 2019-12-27 10:38:38
问题 I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window displayed, with all arguments passed to the invisible batch. The first batch is executed in a console window. However, I do not want the second batch (launched by the first in a asynchronous way ) to also display a console window. I have come up with a VBScript script which does just that, and I put

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

天大地大妈咪最大 提交于 2019-12-27 10:38:31
问题 I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window displayed, with all arguments passed to the invisible batch. The first batch is executed in a console window. However, I do not want the second batch (launched by the first in a asynchronous way ) to also display a console window. I have come up with a VBScript script which does just that, and I put