Skip to main content

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.

1 vote
1 answer
24 views

Batch script does not output file when limited user runs it from an administrator task manually

The Problem: I want to let a limited user restart a Service. This requires admin privileges, and thus the limited user is unable to restart individual services. I also want to create a timestamp file ...
Manan Adhvaryu's user avatar
0 votes
0 answers
47 views

move copies instead of moves

for /f "tokens=*" %%i in (%file_list%) DO (move "%src_folder%\%%i" "%dst_folder%") This resulted in copy instead of move. I need to remove the files from the source ...
Robert J. Gonzalez's user avatar
2 votes
1 answer
27 views

Merge WAV files from different directories according to matching name

I'd like to merge a number of WAV files located in two separate directories. The files are named identically, similar to the following example: \DIRECTORY A C1-05.wav C2-05.wav C3-05.wav C4-05....
black-clover's user avatar
0 votes
0 answers
57 views

Schedule a task with admin privileges Windows 10

I feel like this should be easy but I am not making any further progress. I have seen the other post mentioning Windows 7 and UAC prompts but the accepted solution on that did not post work for me. ...
roar's user avatar
  • 1
0 votes
1 answer
83 views

Restart autosys job after a fixed delay

I have a scenario where I have to retry run the failed autosys command job after 10 minutes. I have to retry rerunning it only twice. I cannot use n_retry attribute here because I need to wait for 10 ...
Priya's user avatar
  • 1
1 vote
0 answers
102 views

Any way for batch conversion from JPG to DDS with DXT1 compression

I have an "file.jpg" image, I open it with GIMP, then go to "File", "Export As...", choose "DDS image". I choose the compression - BC1/DXT1, other options are ...
misha.physics's user avatar
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 ...
Mr.Key7's user avatar
  • 843
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\...
Jwem93's user avatar
  • 109
0 votes
0 answers
64 views

How to suspend Windows PC for a specified period of time using Powershell?

Using Powershell or batch scripts, how to make a PC with Windows OS automatically suspend during the weekdays and automatically reactivate for every weekend? I know that in Linux OS this can be ...
pangratt12345's user avatar
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 & ...
overdriven's user avatar
0 votes
1 answer
73 views

Batch command with quotes fails to move files and delete folder with special characters

I have a custom batch program that I update and run to negate having to constantly waste half an hour just to clean up the Windows start menu every time I'm forced to reinstall Windows. It saves me a ...
John's user avatar
  • 2,147
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 ...
Agodless's user avatar
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-...
Mr.Key7's user avatar
  • 843
9 votes
3 answers
1k views

Why does Windows command prompt command chaining not short circuit when a batch file returns non-zero?

The first premise is that batch scripts will execute all commands in them, even if one fails. @echo off does_not_exist.exe also_does_not_exist.exe C:\Users\user>two_failures.bat 'does_not_exist....
douggard's user avatar
  • 191
0 votes
0 answers
22 views

“psloglist” for system event returns an error: -1073740940

My batch must extract system and application events. I use two psloglist (vers. 2.82) cmd one after the other. psloglist \\Home -d 7 -f we sys > system.log psloglist \\Home -d 7 -f we app > ...
Luciano's user avatar
  • 11
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= ...
Mr.Key7's user avatar
  • 843
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\...
Mr.Key7's user avatar
  • 843
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 ...
Clamarc's user avatar
  • 663
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-...
Mr.Key7's user avatar
  • 843
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 ...
Qwert Yuiop's user avatar
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 ...
Mr. Mendelli's user avatar
  • 1,269
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 ...
Enema State's user avatar
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 ...
Mr.Key7's user avatar
  • 843
-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)...
Mr.Key7's user avatar
  • 843
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 ...
Mr.Key7's user avatar
  • 843
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&...
Mr.Key7's user avatar
  • 843
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 ...
Mr.Key7's user avatar
  • 843
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 ...
Mr.Key7's user avatar
  • 843
-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 ...
Mr.Key7's user avatar
  • 843
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 /...
Mr.Key7's user avatar
  • 843
0 votes
2 answers
179 views

How can I make a custom utility library with functions that will be callable from windows cmd?

How can I make a custom utility library with cmd/batch functions that will be callable from a windows cmd terminal? You can make functions in a batch file, for instance: @echo off goto :main :...
Qwert Yuiop's user avatar
0 votes
0 answers
508 views

Change Regional Format

What is command to change regional format to other region with Batch script? If in powershell, i do this with: $GID=111 Set-WinHomeLocation $GID
Mr.Key7's user avatar
  • 843
0 votes
1 answer
66 views

Get TimeZone Display Name Batch Script

Batch code: @echo off for /f "tokens=1*" %%a in ('TZUTIL /g') do set TZID=%%a %%b SetLocal EnableDelayedExpansion for /f "tokens=1-4" %%a in ('TZUTIL /L') do ( set $U=%%a& ...
Mr.Key7's user avatar
  • 843
0 votes
0 answers
33 views

scheduled batch file stops running and reports error

I have a batch file that contains the following line: @robocopy E:\ G:\ /DCOPY:DAT /xd $* syste* /xf ~* /s /xo /np /copyall /log:c:\back-EG.txt It is scheduled to run on the first day of month. I ...
joehua's user avatar
  • 297
0 votes
1 answer
81 views

In batch code, how to make an input choice instead of typing?

Currently, I list all network adapters, and then the user needs to type the name of an adapter to proceed with the rest of the code. :: Listing all network adapters echo/List all network adapters &...
Rootz's user avatar
  • 15
3 votes
3 answers
689 views

Set Variable in one line Batch

set var1=Demo set var2=%var1% echo %var2% rem Output:Demo Why does set var2 below not work if in one line with set var1? set var1=& set var2= set var1=Demo& set var2=%var1% echo %var2% rem ...
Mr.Key7's user avatar
  • 843
1 vote
1 answer
51 views

Get some spaces in a Batch

In PowerShell: $val = ' ' $val *=5 write-host "[$val]" The Output is 5 spaces: [ ] But in Batch: set "val= " set /a val*=5 echo [%val%] The Output is zero: [0] How i can get ...
Mr.Key7's user avatar
  • 843
0 votes
0 answers
37 views

Send input to running program Batch

I would like to start a cmd line program in Batch and be able to communicate with it. Currently I am starting the program with start /b cmd /c "cli_program.exe" > log.txt. I am currently ...
octalgon's user avatar
2 votes
1 answer
62 views

Get Highest Value from String Batch File

Batch code: set list=4 8 1 for %%a in (%list%) do set highest=??? how can I get and save the highest value into a variable?
Mr.Key7's user avatar
  • 843
0 votes
0 answers
59 views

How to align spaces in CMD code output

My Batch code: @echo off set phones="iPhone 12" "Galaxy S5 4G" "Nokia 7" set manufs=US "South Korea" Finland SetLocal EnableDelayedExpansion set n=& for %%a ...
Mr.Key7's user avatar
  • 843
0 votes
1 answer
125 views

Batch script and get the output value of a found key

All works fine in a CMD prompt, but, I need put in a bat file to run, but cannot get the output of the Reg Query cmd, and then run another query from that. Since what I am looking for is an App ID, ...
LuckyCharms's user avatar
1 vote
1 answer
38 views

How do I show parts of a string?

@echo off set keys=_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 SetLocal EnableDelayedExpansion from keys above, command echo !keys:~1,1! output A, command echo !keys:~4,1! output D. my question: How do I ...
Mr.Key7's user avatar
  • 843
2 votes
1 answer
210 views

How can I check that files match a list of MD5 checksums on Windows 10?

I downloaded a large number of files via this magnet link (Apache 2.0 license), then moved the files around between a few devices. I now want to check the integrity of the files. A file lists MD5 ...
Franck Dernoncourt's user avatar
0 votes
1 answer
83 views

Batch file running in one account but not another

I wrote a batch file to run a schtasks for a Windows 7 Home machine. When I tested it in my account (standard user), the script runs correctly, but when I migrated the script to the account (also ...
Eliezer Meth's user avatar
0 votes
0 answers
30 views

Trying to find .exe over multi drive wide search in a bat file. Tried with relative path commands

As stated in the title I have a bat file set up to locate and run 2 separate exe's. One is located in the same folder as the bat file which for this %~dp0 works just fine. The second exe is one to a ...
heyimvic's user avatar
1 vote
1 answer
61 views

Any way to do a Batch file move operation only when the HDD is idle-ish?

I know how to check if a specific program is running like winrar which might indicate usage on drive d: but is there a better way to determine if a drive is relatively idle enough (via Batch or other ...
Bricktop's user avatar
  • 313
0 votes
1 answer
226 views

batch findstr not working with string saved in a variable

I'm trying to find a string inside a file.txt using findstr and I have the following issue: set "log_file=C:\Tools_Dev\log_file.txt" a-findstr C/:"text to find" %log_file% works ...
Fernando Lisa's user avatar
-1 votes
1 answer
34 views

how to store a variable and reuse it later within the terminal?

In a normal cisco switch if I run the following command: copy running-config tftp: the switch will ask me for a IP address. for my plink I have this: plink -ssh userhere@IP -t copy running-config ...
user3520554's user avatar
1 vote
1 answer
811 views

Batch files run through Task Scheduler aren't working as intended

This is the code I am using. It is something I found on other posts on this site. Script Code #1: @ECHO OFF SET EXEName=TcpSnd.exe SET EXEFullPath=D:\ComputerRX\Pharmacy\TcpSnd.exe SET ...
RPhZach's user avatar
  • 11
0 votes
1 answer
299 views

What secure erase in the fastest way on Windows 10 with cmd? [duplicate]

I have a program in QT, C++ and I want to secure erase the computer after a trigger. After this process, I do not want the old data on the SSD to be accessed by data recovery programs. I want this ...
mrhndsm's user avatar

15 30 50 per page
1
2 3 4 5
81