Questions tagged [batch]
Batch processing is the execution of a set of commands or software programs without user intervention. A batch file is a text file containing a sequence of such commands or programs invocations. Please use the tag [batch-file] for that.
4,003
questions
0
votes
1
answer
47
views
How to Extract Part of Variable After Choice
from How-to: Extract part of...:
set "keys= ABCD"
echo %keys:~1,1%
echo %keys:~4,1%
When part of variable extracted after choice, don't worked except using call
@echo off
set "keys= ...
1
vote
1
answer
209
views
Split The Output of PATH Environment Variable
In CMD, when i type PATH, the output:
Path=C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\...
1
vote
3
answers
174
views
Powershell - keep only lines in txt files contain some selected words
I have a txt file and I would like to keep only a few lines in it
I want to a command that turns this
txt file:
;FFMETADATA1
title=TNT
disc=01
comment=
lyrics-eng=
\
\
\
album=Classic
genre=Older
...
0
votes
0
answers
67
views
How to Fix Error If Variable Contains Double Quotes
Batch Script:
@echo Off
:: Works
::set "var=C:\Program Files\7-Zip\7z.exe"
::set "var=cmd "C:\Program Files\7-Zip\7z.exe""
::set "var=CMD "C:\Program Files\7-...
0
votes
1
answer
99
views
Why does an `echo` with brackets `()` break the `if` statement?
The if statement in following code shouldn't trigger, but it does. If I change echo () to echo [], it works as intended. So apparently it has something to do with the brackets ().
set a=1
set b=2
...
0
votes
1
answer
91
views
Batch Script or CMD Only Able to Process 70 Files at Once?
I made a script for vgmstream that decodes audio streams with some custom options like the output path and logging. I have noticed that the script terminates in the terminal if I exceed using more ...
0
votes
1
answer
39
views
How to extract a part of a line that is between two specific strings using a batch script [closed]
I am trying to extract strings which are between <meta property="al:ios:url" content="snssdk1180://live?room_id= and " data-rh="true">.
Example Input:
<meta ...
1
vote
1
answer
139
views
How a Batch Script recognize the source that executed it?
How does the batch script known the source that executed it?
Executed / called from Command line CMD
Executed from Batch file (either from the file itself or another batch file)
Illustration:
@Echo ...
-2
votes
1
answer
130
views
Faster Way To Getting Administrator Privileges Within Windows Terminal
As far as I know, the easiest way to get administrator privileges from batch Script is by calling PowerShell.
@echo off
fltmc.exe >nul || (PowerShell.exe start -verb runas wt.exe '%~0'& exit /b)...
0
votes
0
answers
62
views
Create Task Scheduler with No Triggers Set
I need to Create a Task Scheduler with parameters:
No Triggers
Available both in AC and DC
I learn SCHTASKS /? help, but haven't found what I mean.
I tried:
SCHTASKS /Create /TN "Test" /TR ...
0
votes
1
answer
230
views
Back from Elevated Admin to Not Elevated
When running Batch Script with Administrator privileges, how to back to not Admin?
I tried this example:
@echo off
:Demo
CLS
fltmc >nul && (echo Admin& set $A=y) || (echo Not Admin&...
1
vote
1
answer
72
views
Remove Empty Line at Top Command Prompt Start Up Display
This question is a continuation of post Modify Windows CommandLine Start Up Text
After I succeeded in modifying the cmd startup display from its origin, so that it looked like this:
CMD:
Still there ...
0
votes
2
answers
88
views
Getting Two Character Variable Without Pressing Enter (PowerShell/ CMD)
Bash Script:
#! /bin/bash
read -n 2 -p '2 digit:' ans;
echo $ans
When i finish input two character, the script continue, without waiting me to press enter.
And what I have pressed saves to the ...
-1
votes
1
answer
281
views
Get String Length - How It Works
I not asking about a problem, only about how it works.
@echo off
Set str=You
Call :$len str len
set len
Set str=I You
Call :$len str len
set len
Set str=I and You
Call :$len str len
set len
Set ...
3
votes
2
answers
413
views
What Equivalent %* of Batch in PowerShell
Batch Script:
@echo off
if not "!!"=="" setlocal enabledelayedexpansion
for /f "tokens=4*" %%a in (
'dir /AD "%USERPROFILE%\" ^| find "DIR" ^| Find /...