Questions tagged [wsh]
For questions relating to Windows Script Host (WSH), a language-independent scripting host for the Windows operating system. It allows scripts to be run from both the graphical Windows desktop (via WScript.exe) and the command prompt (via CScript.exe).
1,075
questions
0
votes
0
answers
46
views
Use VSCode to debug Windows Script Host scripts
Is there a way to configure VSCode to allow me to debug old JavaScript (JScript?) or VBScript routines that run in the Windows Script Host? I'd like to step through the code of each of these scripts ...
0
votes
1
answer
67
views
WSH/Javascript: how to access collection items [duplicate]
I am writing a JavaScript that shall be executed in Windows Scripting Host on the command line with cscript.exe. I need JSON parsing, so I decided on JavaScript instead of VBScript.
Now I am trying to ...
0
votes
0
answers
24
views
VBScript, how to put a dictionay inside another dictionary using .Item setter? [duplicate]
A.S. this is NOT dup: How can I use a dictionary inside a class in vbscript?
i do NOT want to make new classes
i also do not want to make ad hoc wrappers (would i - i would just use array(1) instead ...
-1
votes
1
answer
30
views
How to list all environment variables in JScript [duplicate]
My prog.js looks like this:
var WshShell = WSH.CreateObject("WScript.Shell");
var env = WshShell.Environment("PROCESS");
WSH.Echo(env.Length); // 46
WSH.Echo(env("OS")); ...
0
votes
0
answers
51
views
Unable to redirect output from VBA with cmd in hidden mode
Am trying to redirect output from cmd to a text file using Wscript.shell script. It works when cmd window is in active mode. But doesn't work with cmd windows style is 0 (hidden mode).
Dim objShell : ...
-2
votes
1
answer
727
views
How to access JSON object returned from createObject("htmlfile") in VBS file
I have the following json:
{
"columns":[
"b_summary",
"end_fy",
"id",
"isin",
"market",
"name&...
0
votes
1
answer
611
views
SAP GUI Connection not working after update to .NET 6
I developed a .NET 4.6 Framework project (X64) with access to the running sap-instance.
to connect to sap i used the exactly same way as the SAP-Script:
Script-Version:
Set SapGuiAuto = GetObject(&...
-2
votes
1
answer
7k
views
How to enable your Windows Script Host through Registry Editor?
The error I'm getting:
Windows Script Host access is disabled on this machine. Contact your administrator for details.
From many websites you can find that making a file named: ["Enabled"] ...
1
vote
0
answers
87
views
How can I prompt the user to enter a value in WSH JavaScript?
I tried all the possible ways to enter a value from the user but none of those actually worked;
I wrote these codes in my notepad and saved with .js extension;
For example:
1.
var input = WScript....
0
votes
1
answer
615
views
Getting "Windows Script Host" : Error code 800A03F6, Microsoft JScript compilation error, when executing module after using npm link
Windows Script Host prompts this error when trying to run your node cli
Steps to reproduce issue:
Create simple node 'Hello world' project
use npm link to link the package.
Try running the module ...
0
votes
4
answers
2k
views
Starting and minimizing Quake Terminal at startup
I'm trying to create a WSF that I can run using Task Scheduler at login. I want it to open the Terminal, switch to Quake mode, minimize that and then close the orignal Terminal window.
I've got as far ...
-1
votes
1
answer
3k
views
Activate Windows License
When I use slmgr /skms <URL> | cmd command in PowerShell it shows me a pop up that I must press the ok button after that I run slmgr /ato | cmd and again shows me another pop up that I press the ...
0
votes
2
answers
268
views
Windows Script Host cannot reference type library with version number in hexadecimal notation
I have .NET framework assembly which is exposed to COM. Recently, since the assembly minor version number reach 10, it stopped being usable from Windows Script Host (WSH).
[assembly: AssemblyVersion(&...
2
votes
1
answer
503
views
Why does WScript.Shell SpecialFolders function return an empty string for Default and MyDocuments
To facilitate special folder processing, I wrote some code to return requested values based on an Enum with values for DeskTop, Default, MyDocuments, etc. The enum value is then converted to the ...
0
votes
0
answers
30
views
How to encode a string in base64 in JScript [duplicate]
Well, i think the title is pretty clear, how to encode a string to base64 in JScript?
While researching online i found this:
How to decode a Base64 string in JScript
Yeah, intresting (for Decoding), ...
0
votes
0
answers
321
views
Error 800A01CE, add printer by vbs throught ip
When I tried a small code to add printer on window 10 enterprise 64bits. I meet error 800A01CE. Please help me to resolve this problem. This is my source
Option Explicit
Dim strPrinterUNC, objNetwork
...
0
votes
1
answer
575
views
powershell spawned by .vbs file does not recognize script files... (Windows 11)
I'm simply trying to run a .ps1 from a .vbs (did this before on w10)
C:\Scripts\Test.vbs
command = "powershell.exe -ExecutionPolicy Bypass -nologo -command C:\Scripts\Test.ps1"
set shell = ...
-1
votes
1
answer
368
views
Why does Typescript support WScript?
I have installed Typescript just to have WScript intellisense in VScode.
And I got it. But whenever I compile a typescript tsc myScript.ts containing WScript method WScript.Echo("hello world"...
-3
votes
1
answer
82
views
Why script hangs the host process when buffer size increases to 4MB?
We have added Process class to execute a script. Main method of the script file is defined in the next section. When Script executed the WaitForExit() method of Process class returns false every time ....
1
vote
0
answers
57
views
Why is MS Access displaying a window after closing when automated through vbscript?
I have a vbscript that opens Access and calls a function. The .Visible property for the Access application is set to False in the script. Up until a few days ago I was not seeing any visible Access ...
0
votes
1
answer
250
views
VBS & WSH error on simple loop and cpu over usage
I have a simple script that hunts for popup boxes that are generated for website and Excel.
It works most of the time but errors out occasionlly and seemingly randomly.
The error is
line: 6
Char: 3
...
1
vote
1
answer
343
views
Am I able to embed HTA code into VBScript? [duplicate]
EDITED
My company used VBScript and IE to create popups for gathering and displaying information. Now that IE is going away, we can't do this in Edge. We're looking for a way to use HTA embedded in ...
1
vote
0
answers
231
views
Active Directory VBS Scripting, getting blank or no value for "cn" attribute
I am writing a script to write the computer name ("CN") attribute of computer accounts in an OU of Active Directory into description field of the computer account but I am just getting blank ...
0
votes
0
answers
350
views
Batch scripting - how to pass a flag into a loop and modify the flag if condition met
I am new to scripting and I found this script online that seems to do what I need after I tweaked it a bit. I am trying to close a popup window once it opened, once the popup window opened I need a ...
1
vote
0
answers
696
views
VBA Reconnect Remembered Network Drive
(MS Excel 2016)
I'm trying to find a solution, which can be implemented via vba, to ensure that the network resource for my Excel utility is available and prevent the
{insert path here} is not a ...
0
votes
0
answers
540
views
Executable binary file not working after XOR encryption and decyption
I want to encrypt an exe file (file.exe), write the encrypted version to a text file (fileenc.txt) and decrypt the data in the text file back to another exe file (filedec.exe).
file.exe and filedec....
0
votes
1
answer
300
views
Encrypt binary file with xor Jscript WSH
When encrypting string using xor encryption, things work well. But when dealing with bytes, it does not work for. It throws error at k.charCodeAt(0) Please what could be the problem? This is my full ...
2
votes
2
answers
2k
views
Found this script plus the exe file in my app data folder. I wonder what does this do. Is this a backdoor script to record my key stroke entry?
I recently found a WS folder with in my app data folder, containing a "ws.exe" file, with a script file in the same folder, also there is shortcut added to my startup folder with below ...
0
votes
0
answers
41
views
VB script to find whether it is running in 32 bit or 64 bit [duplicate]
how to find which command prompt(32 bit or 64) is being used to run the vb script when it is called using cscript. I need to capture that info.
1
vote
1
answer
203
views
Where can I find the doc for the function GetObject in Microsoft Javascript?
I cannot find the doc for the function GetObject available in Microsoft Javascript.
I tried with no luck https://learn.microsoft.com/en-us/search/?terms=javascript%20getobject where I found https://...
0
votes
1
answer
756
views
Any attempt to execute vbs script generates a File Not Found Error
The specific error is:
Script: \\dc\netlogon\folder\file.vbs
Line: 0
Char: 1
Error: File not found
Code: 800A0035
Source: Microsoft VBScript runtime error
The file is at the location specified. ...
0
votes
0
answers
17
views
Send Keystroke to Adobe Reader DC to Update
Is there a way to send keystroke to adobe reader DC using script to initiate Update ,
Please help.
Thank you
0
votes
1
answer
845
views
Running python script from wscript fails to activate conda
For some reasons I would like to execute a python script from a vbs-script. It seems that conda isn't activated when I run the script. The pythonfile ImportPandas.py has the following code:
print('\n--...
0
votes
1
answer
385
views
overwrite folders in visual basic script?
I'm working on a way to overwrite a folder if it already exists, with confirmation. Here is my code(along with the part I'm stuck on):
Set fso = CreateObject("Scripting.FileSystemObject")
...
-1
votes
1
answer
3k
views
How beep (or play a system sound) from VBScript, which runs in a window? [duplicate]
How can I make my doalert.vbs script to beep (or at least to play a system sound)?
doalert.vbs is a VBScript
it runs in a window
it is launched by wscript.exe (not by cscript.exe)
0
votes
0
answers
729
views
Do .Exec or .ShellExecute wait for the specified process to terminate before the script continues?
According to SS64, for .Run you can specify bWaitOnReturn to choose whether or not to wait for the process to terminate before your script continues.
SS64's details about .Exec do not mention whether ...
0
votes
1
answer
812
views
VBScript fails when sending left mouse click
I am trying to develop script to open thinkorswim app (stock/option trading software) so that I can use that script inside my W10Pro pc Task Scheduler app to automatically open this app at specified ...
-1
votes
2
answers
105
views
Wscript and Tor Browser
so I'm new to all of this and I need to know if wscripts would work with tor browser, and what would that code look like. i need the bot to go to a website and click a button and then go to another ...
1
vote
0
answers
256
views
Can python 3 be used as scripting engine for an "ActiveX Scripting Host"?
I have to convert an existing python 2.7.15 script to python 3.7.4.
The existing script is launched by an programm which is an 'ActiveX Scripting Host' and works fine.
The problem I encountered is ...
0
votes
1
answer
384
views
Automation of Java keytool command using VBScript to extract certificate metadata not working
Using the Java keytool utility, I'm attempting to automate the reading of metadata attached to certificates in a JKS file from two possible directories and output the metadata to a flat file (all from ...
0
votes
0
answers
34
views
why [CONSOLE]::NumberLock is not working in remote destop system [duplicate]
when i run below command it works fine in my local system but don't know why it not working in remote aws server
@start /wait powershell.exe -nologo -WindowStyle Hidden -command "IF ([console]::...
2
votes
2
answers
329
views
Getting a response from a wsh script
In my HTA app there are some actions which are executing some heavily time-consuming tasks on a server. For example an action uses an old ActiveX component to read some fileproperties (like Subject ...
0
votes
1
answer
1k
views
Using htmlfile COM object to access the .getOwnPropertyDescriptor() method of an object in WSH JScript
In the comments of this question, I was told that the .getOwnPropertyDescriptor() method
isn't supported in ES3 ..., so it probably isn't supported in JScript [either]
and that is indeed what I see ...
2
votes
1
answer
1k
views
WScript.Shell crashes Excel
I am using WshShell to run a batch file from VBA within Excel.
The batch file is VERY simple, one line that runs a number crunching
program. I can run the batch file directly without problems.
I am ...
0
votes
0
answers
193
views
Getting Invalid root in registry key when running CScript.exe from a windows Cmd file
I am running a test.cmd file from a C# exe by creating a System.Diagnostics.Process.
The test.cmd is launching a JScript file using the Windows Scripting Host Command Line as below
C:\myfolder>...
0
votes
1
answer
337
views
How can I split the file and output it with Webpack? This is to avoid the WSH capacity limit
I'm not native English, so I'm sorry if it feels difficult to read.
I am creating a library.
https://github.com/standard-software/partsjs/tree/v9.2.0
I'm building with Webpack and it's comfortable to ...
-2
votes
1
answer
177
views
Proper file transclusion for classic JScript
I want to have something like C's #include directive or Python's import() function. I would appreciate it if you consider that this is not a Javascript, VBScript, nor a JScript.Net question. I want ...
-1
votes
1
answer
272
views
One WSH JScript instance to communicate to the StdIn and StdOut of another instance
I want a JScript instance to send a string to the StdIn of another JScript instance; let the other one processes it and then read the returned StdOut results. Consider the code block below:
// ...
2
votes
1
answer
6k
views
What is the difference between new ActiveXObject() and WScript.CreateObject()?
According to the Microsoft documentation, one can create instances of the COM objects using both the ActiveXObject() and the WScript.CreateObject() functions. It seems like the lines
var objXL = new ...
3
votes
1
answer
265
views
VBScript passing value by reference (VarPtr) to ActiveX function
I'm trying this:
Dim oApp
Dim iReturnedResult
Set oApp = CreateObject("Some.Application")
Set F_Ord = oApp.Documents.Open("Window 1", VarPtr(iReturnedResult))
The ActiveX ...