All Questions
Tagged with batch batch-file
787
questions
3
votes
1
answer
139
views
Change Window Title When Start PowerShell with Sudo.exe
I tried starting powershell with Sudo for Windows from CMD or Batch. Works fine. A PowerShell window opens with administrator rights:
rem CMD/BAT
sudo.exe start powershell.exe
Then, I tried adding a ...
0
votes
1
answer
77
views
How to change file path in BAT file based on the current user?
I have a bat file to run some Python code similar to this:
@echo off
set /P State= Select State:
set /P Year= Select Year:
"C:\Users\MYNUMBER\...
1
vote
3
answers
140
views
Is there a difference between combining commands with & and running them one at a time?
Say I want to run multiple, computationally complex commands on Windows command line.
Does it makes a difference, performance wise, if I combine them with &:
doSomething1 & doSomething2 & ...
2
votes
1
answer
93
views
A batch file with an executable file checks if it is not in the processes in order to run another batch file (or code from it)
There are two batch files. Need to add a condition to the first file if the process is running nvcplui.exe then nothing, and if it is not running, then the second file (or the code from it) will be ...
2
votes
1
answer
186
views
Reg.exe Query Only Works In Interactive Mode
In CMD Console (Interactive Mode), I run the command:
reg query HKCU\Console\%%Startup
The output:
HKEY_CURRENT_USER\Console\%%Startup
DelegationConsole REG_SZ {B23D10C0-E52E-411E-9D5B-...
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\...
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
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 ...