Questions tagged [batch-file]
A batch file is a text file containing a series of commands that are executed by the command interpreter on MS-DOS, IBM OS/2, or Microsoft Windows systems.
3,151 questions
-3 votes
0 answers
31 views
Как запустить команды в свеже запушенной CMD через PowerShell? [closed]
Так как я облазил всё, что облазил, а у "Cursor.AI" спросить не могу веть мой трёх буквенный сервис лёг... :( Суть вопроса: Я не могу понять как мне в свежеоткрытый PowerShell под оболочкой ...
-1 votes
1 answer
45 views
Why is my FFMpeg Bat file to add Track Number to Title not Working
I have created a BAT file to append the MP3 Track Number ID3 tag to the beginning of the title ID3 tag. I want this so that when the song is played in my car, the title that displays also shows the ...
0 votes
2 answers
102 views
Reproduce a target from a windows-link in a batch-file
This is on Windows 10. Intel has a windows-link. In the properties, the target is : C:\Windows\System32\cmd.exe /E:ON /K ""C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 ...
1 vote
3 answers
216 views
Cmd prompt won't recognise certain commands from a batch file
...but recognizes 'em just fine when manually entered on the command line. First time I've seen this in four decades. A new install of win10 Pro 22h2. The batch file in question has run just fine ...
7 votes
2 answers
458 views
Find jpg files without Keywords/Subject in Iptc/Xmp and copy them
I have 10s of thousands of JPG photos in multiple sub-folders under a single folder and quite a few of these picture files have no keywords in their metadata. I want to find a way to scan through all ...
1 vote
1 answer
69 views
Setting Registry to automatically opening specific key/folder fails when set by batch program
My original goal was to have the Windows Registry Editor open up at a specific key. We tenuously accomplished that. However now there there is a new problem. The Windows Registry remembers which key ...
3 votes
3 answers
137 views
How to delete folders within subfolder on Windows that fits a specific pattern?
I'm trying to make a simple batch file that can quickly cleanup my plugins folder for UE5 for a clean rebuild. I have a lot of plugins and would like to not worry about adding them to my current batch ...
0 votes
0 answers
57 views
When creating a Batch File that executes a macro that deletes an Access table, how do I automatically reply Yes to the Delete Table warning message?
The macro is attempting to delete a table and then recreate the table using a MakeTable Access query (Access version Microsoft 365). Here's the batch file: start "" "C:\Program Files (...
0 votes
1 answer
132 views
WindowsTerminal not displaying windowsTitle of other terminals
I have just started with batch scripting, and I'm trying to close(kill) a running batch from another batch. I have set a tile for my main script file, and trying to kill it from another batch file, ...
2 votes
1 answer
371 views
Open folders within same window in different tabs
I have this powershell script and it opens the folders in sepearate windows, in Win 11 I want them to open in different tabs Start-Process explorer.exe "C:\Users\Users\Documents" Start-...
0 votes
0 answers
38 views
How to set a countdown for questions in a batch file for a cleaning PC health check script? [duplicate]
Edit: Sorry, My question is not the same as in this post: "Show only countdown in timeout command: "https://superuser.com/questions/1727173/show-only-countdown-in-timeout-command"."...
23 votes
2 answers
3k views
Running a BAT file and accidentally finding obscure Chinese poem
Accidentally found obscure Chinese poem (BAT file) Something really weird just happened. I ran this in a batch file: wmic timezone get caption>>tmp_ist.bak time/date>>tmp_ist.bak This ...
0 votes
0 answers
35 views
updating xcopy command to robocopy
I am trying to update the following xcopy command to robocopy. I substituted robocopy for xcopy, removed the "" and the switches except for /e. It fails. How do I fix it? xcopy "c:\...
1 vote
2 answers
445 views
Windows Batch - Return ENTER key as "choice" command option
Is there any way I can input the enter key on the "choice" command and get returned an %ERRORLEVEL% variable? I expect to press 1, 2 or ENTER as my "choice" command options, but I'...
3 votes
1 answer
211 views
Script to swap two words in folder name
At work I've got a Windows directory housing about a thousand folders named Name, Surname and need these to be named Surname, Name I've done some searching here and on StackEx and haven't found ...
0 votes
1 answer
88 views
Monitor a window title and trigger action on change (Windows)
I already found out how to get the window title of a certain process and save it to a file with the following cmd: tasklist /fi "imagename eq process.exe" /fo list /v | find "Window ...
0 votes
1 answer
172 views
Windows command to copy known file from unknown folder [closed]
I'm in a situation where I want a Windows batch file to copy a specific file from a folder with known topology, but unknown what the exact folder names are. So a path of the form, Inbox\XXX\YYY\file....
0 votes
1 answer
703 views
How can I batch convert PNG-8 images to WebP while preserving the original indexed color palette?
I have a folder containing PNG-8 images (indexed color, 256 colors), and I need to convert them to WebP format while preserving the original 8-bit color palette. I'm using Windows 11 and prefer a ...
0 votes
0 answers
151 views
Fastcopy quits before batch file finishes
I have 2 USB3 external drives (F: and G:) and use Fastcopy (version 5.8.1) to copy large files containing backups to them. Files are larger than 1TB. The files are stored on a Windows 10 PC, on local ...
1 vote
3 answers
215 views
How to parse sequence of NUL-terminated strings in batch script?
I'm trying to list different entries in the Systemd-boot with a batch shell script, however I'm having trouble parsing the command output and storing each entry as a separate variable. The following ...
0 votes
1 answer
492 views
How to prevent Windows warning window when running a .bat file as Admin
I use a shortcut which runs as admin (this is set in the shortcut options) to run a .bat file that requires admin privileges. Now, everytime it runs, I have to allow it due to the warning window from ...
-1 votes
4 answers
202 views
What command can be used to delete files, but keep files with specific text in name?
I have many files within D:\cert I want to delete, but also want to keep some files with specific text within the name - how do I remove all *.pdf files, but keep *_sign.pdf and all subfolders? ...
1 vote
1 answer
250 views
Recursively setting all .mp4 files name as it title
This script is supposed to copy the file name and set it as the title (EXIF metadata) of the video, I got the ExifTool command to from the Video Stack Exchange, and it worked as expected, but I now ...
1 vote
0 answers
59 views
Algorithm for determining program is installed on the system
I have this program that claims to determine if DOSBOX is installed on the system regardless of the location of the executable folder @echo off setlocal EnableDelayedExpansion echo Search DOSBox REM ...
-1 votes
2 answers
251 views
Run multiple .bat files in all subfolders
I have 932 folders, each containing an album in mp3 format. I have a batch file named Makeplaylist.bat that creates a playlist file from the files and then deletes itself. It runs perfectly if I run ...
0 votes
0 answers
51 views
How do I batch copy existing file names and use them as new folder names? then move the files in the created folder [duplicate]
i have many *.iso files in a folder , then i want to create a subfolder for each files based on their file names and move the files to each folder iso files run as admin folders created i have tried ...
-4 votes
1 answer
263 views
Set the date back by 2882 days in command line / bat file
Task: set the clock back 2882 days in a .bat file. This is a requirement because a batch file calls a sequence of simulations and the task must be performed before executing the sequence. Apparently ...
1 vote
1 answer
468 views
How to run several curl cmd commands, each found in a separate .txt file in one folder?
If I have a certain folder with a number of .txt files, each contain a single curl cmd in a single line, I want to be just able to point to the folder then all of these commands are launched once, ...
1 vote
0 answers
133 views
Can I run a program under windows in a compatibility mode using pcalua.exe?
It is not "officially" documented but looks like pcalua.exe is the command line interface for the program compatibility assistant on Windows. Also not officially documented but you can start ...
1 vote
1 answer
197 views
Prevent the change to the window title by an application executed from the default Windows command prompt
I have a batch file (mybatfile.bat) containing the following code: @echo off python main.py So I create a shortcut to the mybatfile.bat for removing the "Administrator" string in title ...
2 votes
0 answers
278 views
How can I get resolution, bit rate, and codec from a video file that has missing metadata?
I have thousands of videos with metadata missing. Tools like ffprobe and mediainfo rely on that metadata, and even using filebot has't resolved this problem. How can I process thousands of video files,...
0 votes
1 answer
241 views
In Command Prompt, why does the %ErrorLevel% not affect whether the second echo command runs after the && operator?
Issue The && operator does not respect the %ErrorLevel% value. The command following the operator runs despite %ErrorLevel% being equal to 99. Command cmd /c exit 99 echo %ErrorLevel% echo %...
1 vote
2 answers
372 views
How I can automatically Disable/Reenable "Intel (R) Iris (R) Plus Graphics ", when my Windows 11 turn on from hibernate
To keep my story short, I have HP Pavillion laptop 64-bit, and it was shipped with Windows 10 Home edition, last year I upgraded it using Windows update to Windows 11. I start facing this issue, if ...
0 votes
1 answer
442 views
Dynamically set variable in a batch file, where the variable name exists in another variable
I am sorta just seeing what is possible and what is not, when making batch files. I know it's quite a dated language but very interesting and still very functional. I am surprised that I couldn't find ...
3 votes
2 answers
305 views
How to find partition number or starting offset given volume attributes?
To clone a partition using dd.exe which comes with MSYS2 for Windows, we require 3 pieces of information. physical drive name partition starting offset (in MiB) partition size (in MiB) dd if=...
2 votes
2 answers
278 views
How Can I Write 'Stream:$DATA' in PowerShell and Delete ':$DATA' in Batch?
Attempted to remove :$DATA Stream from a file in cmd and nothing works, except powershell, it is no longer possible to remove using pure cmd/batch? Recreating/reproducing the scenario and showing the ...
0 votes
2 answers
171 views
bat script behaves different when coming from curl pipe
I have a very simple bat script and I'm trying to execute it directly from curl on a windows 10 machine. @echo off SETLOCAL ENABLEEXTENSIONS SET ME=%~n0 SET PARENT=%~dp0 set VER=0.1 @echo %DATE% %...
0 votes
1 answer
839 views
Dynamically change a file name when using FFmpeg
I am currently trying to compress all of my video files (anywhere between 30GB and 500GB) and i have found out a way to get the batch file to run it for all of my files in a folder but it keeps giving ...
1 vote
0 answers
85 views
how to Extract Pdf comments into fdf format into text file thru running a cmd/bat file? [closed]
I have lost a bat file created by someone and hope to find some expert to help on this. We used to save the pdf file to fdf format and click on the bat file, it will automatically extract the comments ...
2 votes
0 answers
1k views
Open multiple folders using a batch script, but open them in one window in multiple tabs
I need a code to open multiple folders in one click using a bat file and open them only in ONE window, displayed in multiple tabs. I found a code where it can open multiple folder in one click using a ...
1 vote
1 answer
156 views
Why are my in-progress (*.bat) batch files all "pausing" simultaneously?
Summary I have seven Windows batch (*.bat) files running continuously on Windows Server 2008 R2. These files simultaneously run into an issue on a recurring basis that causes their cmd.exe (Windows ...
-2 votes
1 answer
557 views
How to request a URL every minute with Curl in Windows?
I would like some advice, am trying to request a URL every 1 minute to feed keep track of a computers uptime I have tried to use a bat file with the below: curl https://example.com timeout /t 60 loop ...
0 votes
1 answer
112 views
How to execute my script at RunOnce step
I'm trying to download a file using cURL at system startup. My script: @echo off echo "Hello, RunOnce script!" echo "Hello, RunOnce script!" > file.txt echo %~dp0 curl.exe -L -...
0 votes
1 answer
208 views
Using rmdir in a FOR loop to delete subdirectories in user/appdata/local/temp
I perform maintenance on several windows 10 VMs. One of the tasks is to clear out the user/temp folders. I discovered I could use for /F "tokens=*" %a in ('dir /ad/b') do cmd /c del /s/f/q &...
0 votes
1 answer
272 views
How can I display an error message from a command in a .bat file?
I have a Windows batch file containing the command rmdir dirname. rmdir can produce a number of different error messages if it fails. The command mshta "javascript:var sh=new ActiveXObject( '...
0 votes
1 answer
148 views
Variables in ffmpeg
I'm trying to do a basic batch script for create video titles in movie files (*.ts) but it doesn't work when adding SET variable. @for /r %%F in (*.ts) do ( echo %%~nxF set /P moviename=NEW VIDEO NAME:...
0 votes
1 answer
1k views
How to get windows to open a Minecraft server on startup
So far I've tried task scheduler directly which didn't work. I figured I can right a .bat file to start my server as follows. "start java -jar "C:\Users\{username}\Documents\Minecraft server\...
0 votes
1 answer
90 views
Batch file to copy from local drive to ftp [duplicate]
I need to create a .bat file which will copy an excel spreadsheet to an ftp folder. I am able to do this manually by dragging and dropping the xls file. I know how to set up windows task scheduler to ...
2 votes
1 answer
119 views
Unable to run a for loop with Findstr in a batch script
I have below batch script, which basically looks for CurrMonth in the file and set the the third token to the month when i do findstr /c:"CurrMonth" %SPOOL_FILE% , it get the result as below ...
1 vote
1 answer
543 views
New to FFmpeg and unsure on how to order arguments
I am new to using FFmpeg and would like to learn how to batch encode a folder of MKV files with the following parameters or what to do in these situations: H264 MP4 output Selection of certain audio ...