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.
3,986
questions
3
votes
2
answers
4k
views
Simple Batch Method to Output Filename + CRC32 on One Text Line
My batch skills are limited. To produce results for many files, I use DIR /a-d /s /b > dirlist.txt. I import dirlist.txt into Excel (column A), and use that to produce file-by-file commands (in ...
3
votes
4
answers
2k
views
Is it possible to use multiple delims based on character position rather than character value in Windows 10 Command Prompt to rename files?
The problem and question in a nutshell before the verbose details of my quest below:
In windows-10 command prompt, I need a single ren command to rename all files in the following format:
vfx_444xx....
1
vote
2
answers
335
views
Mock a failure and success command calls in batch for testing purposes
Is there any command I can use in place of <command>, with some argument in place of <argument_that_fails> and <argument_that_succeed>, such that echo %IS_SUCCESS% would print FALSE ...
0
votes
1
answer
255
views
Using a Windows XP Batch script read in a list of filenames and then parse filename to create new filenames
I have a very old Window XP program that I want to automate a little. It takes three parameters:
ITF.EXE <control-file> <input-file> <output-file>
and it only accepts 8.3 ...
5
votes
4
answers
7k
views
How can I determine the location of the current user's Documents folder from a Windows batch script?
I know I could use %userprofile%\Documents, but this only works if the Documents folder is still in the default location. I am looking for something that works even if the user has changed the ...
2
votes
2
answers
7k
views
grep string equivalent in windows 7 to 10
I want to find a command in windows equivalent to the following command in linux:
cat file.txt | grep -oP '\d{5}-\d{5}'
Out
99527-86793
with:
findstr /R "pattern" file.txt
I try this but it ...
1
vote
1
answer
544
views
Powershell: Fails calling function when run as batch
I have created a GUI for my script. The user selects from two lists, and then clicks a button to load the programs. In ISE, everything works fine. However, when run from a batch file, (or *ps1 file ...
1
vote
2
answers
91
views
Windows Batch File Environment Variable order dependancy
I've got a simple batch file that is trying to create some folders before an application launches.
But I've hit a odd problem that I don't understand why its occurring.
The batch file takes 1 single ...
0
votes
1
answer
321
views
For Loops in Windows Batch files
I have some for loop code in a Windows Batch file for youtube-dl which looks like the following:
for %%a in (%*) do (
.\youtube-dl.exe ^
%%a ^
--playlist-start 1
timeout /t 300
)
I then put this code ...
6
votes
3
answers
26k
views
Unable to start service in window 10 by using NSSM
I have create a small script file to test.
This my script.bat file.
sc create myService binpath= C:\Users\Admin\Desktop\test.bat start= auto
This is my test.bat file.
echo "Welcome to Wizard"
...
0
votes
3
answers
3k
views
Windows batch file to move files to subfolders based on file name
I had never built batches and I am having difficulty finding the syntax to do the following.
I have a ton of files stored in a single directory which I wish to move into subfolders(some already exist, ...
0
votes
1
answer
482
views
Syntax of the command is incorrect
I am looking into creating a batch file that runs at startup, via GPO.
The batch is going to install TeamViewer host so we can deploy this to our end users without any input from them.
The script is ...
1
vote
0
answers
285
views
Assistance with an uninstall Batch file, possibility of running a do/for within a do/for
I am relatively new to creating batch files.
Would someone be able to assist me with me with the following:
I have a piece of software called "ABCSoftware", it installs on every user profile....
0
votes
1
answer
3k
views
Windows Batch Script and handling file names with "!" Exclamation point in For Loop
Part of my script I am having issue with is here:
setlocal enabledelayedexpansion
for /r %%a in (*) do (
cd "%%~dpa"
set /A count += 1
set fn=file!count!
%batchdir%\7z.exe a -mx9 -sdel -p"%password%"...
8
votes
1
answer
7k
views
Modify how Doskey macro passes arguments to the command based on arguments passed to it
I have a farily simple doskey macro
DOSKEY s="C:\Program Files (x86)\Git\bin\sh.exe" --login
So I could switch from command prompt to git shell by s
But sometimes I only want to execute a single ...
-1
votes
1
answer
77
views
.mp3 works .aac does not for merging picture + audio in batch
This works when its .mp3 however it doesnt work if the audio file type is aac, what am I doing incorrectly?
echo off
for %%a in ("*.aac") do (
ffmpeg -i "%%a" -an -vcodec copy &...
7
votes
4
answers
39k
views
Run a process and return its PID (as CHP.EXE) for a batch file
I'm looking for something like chp.exe, it can runs a command and returns its pid.
I can not use CHP.EXE because it seems to be reported as infected file in some antiviruses.
Thanks
3
votes
2
answers
12k
views
How to do I batch change icons of folders in Windows 10?
I have a folder of 10 folders and I would like to change each folder to a different icon. Each of those icons is already made in another folder. (each folder will have a different icon)
How would I ...
3
votes
2
answers
2k
views
How to use ffmpeg to programatically remove video streams?
So, I'm trying to refactor some old code that should remove video streams, compress the audio stream and repack the mp4, which should be a video file with only an audio stream. I later intend to ...
2
votes
1
answer
3k
views
What's a good way to batch check media files for integrity?
I have some 15000 image, video and audio files (and also a few others) that I have been bouncing back and forth via FTP from my phone. After so many times, I found out that a few of them were ...
1
vote
2
answers
2k
views
Recursively adding extensions to files in Windows CMD without renaming the subdirectories
I have a directory with several files that do not have a file extension. This directory also has several subdirectories that have the same thing.
I am using the forfiles command to add a file ...
2
votes
2
answers
2k
views
Loop/Batch file for extracting all .aac from .m4a files in folder
I'm desperate.
I need to extract the .aac stream from ~1749 .m4a files with ffmpeg, but I can't get a batch file working for me and it would take years to do it manually.
This is what I use for ...
4
votes
2
answers
6k
views
How to create "Send to "FOLDER" " similar to send to desktop shortcut?
I've been trying to keep some files in a separate folder as shortcut, so that I can keep track of my favourite media files and images etc in a specified folder as shortcut. I don't want to always copy ...
1
vote
2
answers
8k
views
How to connect to a wireless Display adapter automatically through scripts or Task Scheduler?
I am trying to project files to a Samsung TV which has a windows display adapter. I want to automate the entire process. So when the TV is switched on, I want the computer to continuously check for ...
2
votes
3
answers
10k
views
How do I open a random file in a folder, and set that only files with the specified filename extension(s) should be opened?
How do I open a random file in a folder, and set that only files with the specified filename extension(s) should be opened? (While preferably, supporting Unicode filenames too.)
I've already looked ...
-3
votes
2
answers
58
views
Delete files with different extensions
i have the following problem:
the software with which I read out my defective hard drive gave me all files with duplicates sometimes up to 15 times. One file with its duplicates looks and are named ...
1
vote
1
answer
709
views
How to store JUST a space in a variable in a batch file?
I am making a text to binary encoder with a batch code. In order to do that, I need to know how to store just a space inside a variable. The code below is an example of how it may be.
@echo off
set ...
0
votes
1
answer
347
views
Localization of variables in Windows batch script
I'm declaring and defining 5 strings, which I then perform some
analysis on via function calls. The first function calculates the
length of the strings, and the second count the spaces in the strings.
...
0
votes
1
answer
501
views
Add a variable to a batch process
I'm using ffmpeg to rip some video files. I am looking to rip each video to a size of about 500 MB. To achieve this, I need the option to enter the video bitrate I choose for each individual file.
...
0
votes
0
answers
86
views
Batch file - how to create a folder with a promt, and then copy a file into that folder
I have a specific issue I'd like help with.
I want to write a batch file that first prompts a user to name a folder, to be created in a designated location. I then want to copy a file from a ...
0
votes
0
answers
246
views
7Zip - Zipping 50 files at a time in a folder to separate zip files
I've got a folder of 1000 files. I would like to set-up a batch using 7Zip so it will zip 50 files using a separate zip each time.
e.g
File 1-50
1.7zip or 1.zip
File 51-100
2.7zip or 2.zip
Is it ...
4
votes
2
answers
6k
views
Copy random file from random subfolder into destination folder using a windows bat script
I'm attempting to pick a random 100 songs to copy to my mp3 player so I have something new to listen to each morning without having to drag and drop random files myself (I can't put my entire library ...
5
votes
2
answers
11k
views
Batch convert WebP files to GIF files offline?
Writing a batch script to convert all WebP files to be GIF format.
Looking at the closest utility offered by Google, I don't see an immediately obvious way to do that. I don't like having to use ...
1
vote
1
answer
10k
views
Batch, The system cannot find the batch label specified
I have a batch script with a function called :DispLogo in it, however, when I call it states The system cannot find the batch label specified: DispLogo. It is 100% there. I've tried renaming it with ...
10
votes
1
answer
12k
views
Configuring Windows 8/8.1/10 File History via command line
tl;dr: Is there a way to configure windows 8 file history via unattended command-line/some script?
long story:
I'm configuring a lot of stand-alone (non-domain) PCs and I think some backup is better ...
7
votes
0
answers
5k
views
Robocopy loops/nests "Application Data" 29 times when copying "Application Data" folder on Windows 10
My goal here is to be able to back up my entire computer by using robocopy. My robocopy script keeps getting stuck here as you can see with the Application Data.
C:\Documents and Settings\All Users\...
0
votes
1
answer
2k
views
Batch copy creation date in .MOV video file to created date
I have hundreds of .MOV video files recorded with my iPhone. Their "created" and "modified" file dates are the date where I moved them over to a folder on my Mac. "Media information" in VLC confirms ...
0
votes
1
answer
328
views
combining two batch file into one
I'm using two commands on for removing subtitles audio etc. and the other one is to merge subtitle with mkv file in the same folder.
This for removing the subtitle or audio:
FOR /F "delims=*" %%A ...
1
vote
1
answer
3k
views
Batch file with a recursive for loop to move file
I am trying to create a batch script to move files base on search criteria into another folder of the same subfolder structure.
Tried the following but the result is not quite right.
for /r "c:\...
0
votes
1
answer
1k
views
How to make ORelio Minecraft Console Client move player every 5 minutes
I'm using ORelio's Minecraft Console Client to bring my alternate accounts onto a server. I have written a windows batch file that can open the client, log into my account, and then connect to a ...
1
vote
1
answer
569
views
batch convert DTS to Ac3
I'm looking for a way to run a script file in folder that contains mkv files and copy the video and subtitles and everything else as it is except the audio, convert it to AC3, and saving the new files ...
1
vote
1
answer
698
views
How to run a .batch file as if it were a .bat file
Context: I have associated .batch extension to be opened by my text editor by default when double-clicking or hitting ENTER on it in the Explorer (default action for "Open").
(I probably can't do ...
3
votes
1
answer
7k
views
Windows Batch For Loop - Variable not setting
EDIT: It appears I had a stray GOTO :EOF at the end of an ECHO statement, and it will actually GOTO :EOF... d'oh! Thanks for responses. I think the bug is squashed now.
I have a script where I want ...
0
votes
3
answers
147
views
Repeating a goto only 15 times
echo off
:abc
Echo ^ text ^ >> C:/files/text_%random%.txt
goto abc
How do I do the goto only 15 times?
-1
votes
1
answer
398
views
How to delete all folders in desktop using cmd/batch?
If we want to delete all files in desktop we usually use,
del desktop\*.*
What if we want to delete all folders and subfolders in desktop ?
i tried,
rmdir desktop\*
doesn't works. Pls fix and ...
6
votes
1
answer
61k
views
Batch file gives "the system cannot find the file specified" but commands run fine in cmd
I'm trying to run a simple batch file:
@echo off <-- don't print this line or any of the preceeding lines to the console window.
pushd "K:\" <-- in the quoted directory
for %%j in (*) &...
2
votes
2
answers
14k
views
Error when trying to copy over the network using robocopy
C:\Users\Alex.Newton>robocopy /"\centlpf01cz6c\c$\Program Files\ProgramName\/" /"
\centlpf01cz6c\Program Files\TestBatch\Test\/"
--------------------------------------------------------------------...
2
votes
1
answer
3k
views
robocopy batch file is giving Error codes 2 and 3
I have a batch file to get robocopies of rar files from different places it used to work just fine but recently it is giving me error code 2 and 3 but the robocopy is working Fine I didn't even change ...
1
vote
2
answers
1k
views
Corsair iCue -- Programming Mouse Button to Launch .BAT file which changes Default Audio Device in Windows 7 -- Does Not Launch
I'm running Windows 7 x64 and have recently installed a Corsair Scimitar Pro mouse and iCue 3.5.111 to drive the special features of the mouse, like programmable side-buttons.
I'm trying to map to ...
4
votes
1
answer
10k
views
Windows Batch Script to Compare Two Text Files
I have this script:
for /f "delims=" %%a in (data_A.txt) DO (
set "flag="
for /f "delims=" %%b in (data_B.txt) do (
if "%%a"=="%%b" CALL :flagit
)
if not defined flag >>...