All Questions
Tagged with wsh batch-file
63
questions
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 ...
0
votes
1
answer
468
views
Can't use bat file when running cscript command
I'm making a cmd text based game that runs music in the background but every time I run the command with cscript it wouldn't progress to the menu screen but if I run it with the start command, it won'...
2
votes
2
answers
1k
views
How to escape equal = sign in VBS Shell command parameter
Using VBS on Windows 2012 R2 I am trying to pass a command line parameter isActive="false" but I cannot get the equal sign to appear in the command line.
Create a dummy batch file like test.bat
...
1
vote
1
answer
5k
views
WScript.Shell AppActivate doesn't work every time
I have a few scripts to help running a program in CMD. The first script that starts the sequence is run on startup. In the process, I'm running a VBScript with which I'm trying to focus on the CMD and ...
1
vote
2
answers
601
views
Listen for pop-up and close it using windows batch file
I have the following batch file used to close a time-out pop up window (with the title "Information") when it shows, so that I do not get logged out of a system. However, if the pop-up window is not ...
0
votes
1
answer
376
views
prnmngr.vbs - parse and format output as csv from a windows batch file?
@ECHO OFF
setlocal enabledelayedexpansion
for /f "tokens=*" %%f in ('Cscript %WINDIR%\\System32\\Printing_Admin_Scripts\\en-US\\Prnmngr.vbs -l -s myserver1.com') do (
echo %%f
)
pause
output looks ...
0
votes
1
answer
1k
views
Print double quotations with WshShell.Sendkeys and windows batch
I have a script that changes the users directory and prefills the input with a command, so he only has to look it over and change values before pressing enter. The command that's going to be written ...
1
vote
1
answer
173
views
Difference between %RANDOM% and Math.random() in terms of randomness
I have a hybrid batch/jscript file (using cscript) that has to randomly pick a quote from a text file. So, I need some RNG to call that is sufficiently random for results to not be too repeating ...
1
vote
1
answer
1k
views
How to prefill the command prompt with some chars?
In a batch file, I want to open a command prompt (and keep it open), and prefill the command with the text "git clone", so I just need to copy a project's URL.
This is how I open a command-prompt and ...
0
votes
1
answer
598
views
Return cscript output to batch [duplicate]
My batch script is performing an HTTP request by using CScript with Javascript syntax like in my example.
Using this approach (also seen here) and some help on escaping i tried the following:
@if (@...
8
votes
2
answers
56k
views
Run a bat file from javascript
I'm trying to run a bat file using javascript. I've tried using powershell but it didn't seem to work properly. Here is the code I tried:
var oShell = WScript.CreateObject("WScript.Shell");
oShell....
2
votes
2
answers
4k
views
How to stop a VBScript that was started in a batch program?
So I am making a game in batch programming and I decided to add some theme music to the title menu screen. The way I added the music was by using WScript and a VBScript to play a mp3 file.
The only ...
1
vote
1
answer
1k
views
Reset all Windows 10 user passwords [duplicate]
I am deploying Airwatch to my organization. On company-owned laptops, I would like to lock them down if/when the device is ever un-enrolled. There is no built-in method of doing this, so I am looking ...
2
votes
2
answers
5k
views
Batch file message box: Carriage return in message body
I'm successfully showing a message box from a batch file using this method given by boflynn for a previous question.
I'm trying to insert a carriage return into the message box body text but all my ...
6
votes
2
answers
2k
views
How to use ANSI escape sequences with CSCRIPT on Windows 10?
I'm trying to use the new VT100 ANSI escape sequence capabilities available in the Windows 10 console with CSCRIPT (JScript). But I cannot get it to work.
Here is a really simple JScript script:
...