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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
139 views

Windows 8 Batch file issue

Batch Programming Hello! I am trying to write a batch program which can delete all files having the same extensions anywhere in my computer location C: and on my desktop. But when it does work. Here ...
Letonnerre's user avatar
0 votes
2 answers
372 views

Batch File - Is there a way to insert something like a page break to have different colored text?

I'm writing a batch file and wanted to know if there is a way to separate colors with different lines of text to highlight something. The batch file would have to be able to run on different PC's so ...
Mister_G's user avatar
0 votes
0 answers
374 views

Issue writing batch file for a logon script to add registry entry at logon

This is the key I need to add during the login of a user. We have no login scripts currently and I'm just losing it on how to make a batch file to do it. This is extracted from the .reg file. Is it ...
turnerdb001's user avatar
4 votes
2 answers
8k views

Prevent "Exit" command in script to close Cmd

I have a .bat which emits "Exit 1" in case of failure, this is closing the cmd window and prevents user to see the details of error. I would like to force cmd to stay opened to see the ...
AFract's user avatar
  • 143
0 votes
1 answer
523 views

ffmpeg - Strip specific audio track from multiple files with batch script

I am trying to create a batch script that will strip a specific audio track from multiple video files using "ffmpeg". The audio track has the same ID on all files. after performing "...
agon024's user avatar
  • 101
-1 votes
1 answer
181 views

Substring after two character occurrences

I want to select a specific part of a string that could be like this: <text1>_<text2>_V1_0_<text3> I've tried something like this: set current_folder_path=%cd% set version=!...
NicoFC34's user avatar
1 vote
1 answer
294 views

Cannot remove curly single quote character from file names, with batch file (Windows)

This works in a batch file to remove the letter "y" from all file names next to the batch file: setlocal enableextensions enabledelayedexpansion for /r %%A in ("*.*") do ( SET ...
bat_cmd's user avatar
  • 541
1 vote
2 answers
2k views

Inside cmd batch script recursive for loop, get matched files path relative to script file

I am trying to achieve this by substracting %~dp0 from %%~dpa, where %%a is the for loop variable. If anyone is aware of a better way to do this, please advise. My code is as follows: @echo off ...
HLLL's user avatar
  • 115
1 vote
1 answer
1k views

FORFILES in batch to delete specific suffix files older than a week

I want to use FORFILES in batch to delete ONLY txt(beginning with localhost_access_log) files (not subdirectories) older than a week. But I am getting %%t was unexpected at this time. for %%t in (.txt)...
Cell-o's user avatar
  • 421
0 votes
0 answers
19 views

Restrict write access while batch is running (Win CMD) [duplicate]

I have a simple batch process running once per day to manage a disk quota (simply deletes all folders in excess of quota, oldest first). Works fine for what it's designed to do. Among other tasks, ...
Jughead135's user avatar
1 vote
0 answers
131 views

Is there any way to have a Batch file read motherboard and BIOS info automatically within standalone FreeDOS?

I'm basically looking for a way to output a system's motherboard model (and possibly BIOS version, but that's just extra) so as to turn it into a variable to use in a batch file running in FreeDOS. ...
Tyler Jackson's user avatar
0 votes
1 answer
531 views

What is the equivalent of shell variables $@ in windows command?

I want to put a variable in my command batch script for multiple arguments as the number may vary. Just as in shell we use $@. I tried several things but nothing is working. [Edit : I know %* works, ...
Moorthy's user avatar
1 vote
3 answers
4k views

Batch Command for folder refresh

In my windows 10, I can't see latest files until I refresh the folder. Is there any batch command who can refresh only a particular folder. The batch command, I am finding on Google is either ...
Mohit's user avatar
  • 11
4 votes
3 answers
5k views

Copying files into certain directories based on filename

I don't really have any real touchpoints with Batch or PowerShell, nevertheless, I have set up an employee directory for which I am now looking for a solution, where documents are automatically copied ...
BlackArch.py's user avatar
1 vote
1 answer
837 views

Execute batch file when .log file contains text

I've done a lot of searching around and trial and error. I thought this would be a simple task, but I'm not having any luck... I have a .log file (call it output.log) that automatically gets updated ...
jeromes13's user avatar
1 vote
1 answer
248 views

Anyway delete unique files with a .bat file, using another folder's content as reference?

I'm trying to delete files from a "FolderA" using a "FolderB" as a reference w/ a Batch File. For Example: C:\FolderA C:\FolderB Item1 Item1 Item2 Item2 Item3 Item3 gets ...
Kanon's user avatar
  • 13
0 votes
1 answer
77 views

batch programming: initiating program

Let's say you have a batch script "main_batch.bat" that will be called/started by a number of different programs like "batch1.bat", "batch2.bat", "program1.exe",...
A.B.'s user avatar
  • 11
2 votes
4 answers
12k views

Is it possible to get a recursive directory listing with details in Windows?

For example, suppose I want to see the file sizes of all the *.txt files in a tree. Currently, I can do: dir *.txt /s But the list is not formatted well and is hard to use. I would like to know if ...
pbarney's user avatar
  • 727
2 votes
2 answers
1k views

copy an & to the clipboard using a batch file

I have the following batch file script that I trying to run that will fetch my password to my clipboard. I have tried multiple different methods but I can't seem to get it to work. set "passwd=...
Daniel L. VanDenBosch's user avatar
0 votes
1 answer
2k views

Batch script - copy file into all subfolders [closed]

Here is my directory structure: I am simply looking for a batch script that will copy "srt.bat" to all the folders in the same directory.
agon024's user avatar
  • 101
2 votes
1 answer
473 views

Plink using PuTTY colour scheme

I'm trying to open plink from a *.bat on Windows 10, with the colour scheme defined from an existing session in PuTTY, and while the commands are correctly executing, and the right results displayed, ...
Lolo Irie's user avatar
1 vote
3 answers
166 views

CMD crashes without any error when running Citrix clean up tool

I have had a cmd batch file to reset my Citrix receiver: @echo off set /p Choice="Do you want to reset Citrix settings? (y/n)" if (Choice==y) (goto :RESET) else (exit) :RESET start "...
Foad's user avatar
  • 626
2 votes
3 answers
28k views

Run Powershell with parameters from batch file

I have this PowerShell command that I run from directly from the PowerShell terminal on my Windows 10 system and it works great. PowerShell Get-AppxPackage | % { Add-AppxPackage -...
Marcelo V's user avatar
0 votes
0 answers
388 views

PsShutdown needs admin rights when setting t neq to 0

In a batch script on Windows 10 using PsShutdown to sleep my PC I noticed that PsShutdown needs admin rights if setting -t to everything except 0. You get an "Access is denied" message if ...
loxia_01's user avatar
1 vote
1 answer
691 views

Why is the Batch script I created to convert MP4 files to GIF files with FFmpeg not working?

This is what I have so far. It runs, but throws an error. I have come up with the following below. for %%a in ("*.mp4") do ffmpeg -i "%%a" -t 3 -vf "fps=10, scale=320, flags=...
Christopher Shaw's user avatar
0 votes
1 answer
448 views

Make batch execute command on each line in my multiple files?

I have the following bat: echo >> "log.txt" setlocal for /f %%i in (NAMES.txt) do ( for /f %%j in (HOST.txt) do ( ...entire batch processing ) >> "log.txt" ) &...
Mateus Damasio's user avatar
0 votes
2 answers
2k views

Command Prompt extract jpg files with full path

I need a batch command to list all files (with extension .Jpg, .Txt) here is one command dir /r /s /b output of command: C:\Users\vb3\Desktop\docs\news.mp4 C:\Users\vb3\Desktop\docs\speech.mp3 C:\...
Sadam's user avatar
  • 134
2 votes
1 answer
1k views

Create a shortcut using batch with quotes in the Target

Based on: How to create a shortcut using a batch script? I can't figure out how to write this batch so all the quotes are in the right place and create the shortcut file. I used the above info as ...
NateMac00's user avatar
1 vote
1 answer
943 views

Using wildcards with the rd command inside for

I want to delete all folders starting with "machine.contoso.com" (including all subfolders and files). I tried this command: I get an error, though :( cd c:\Program Files\Software\Temp for /...
Cell-o's user avatar
  • 421
0 votes
1 answer
65 views

copy folders and content to a external drive

i have this for /F "delims=" %%a IN ('dir /b /s /ad "*"') DO ( FOR /F %%c IN ('dir /b/s "%%a\*.txt" ^') DO XCOPY "%%a" "J:\" ) but it only moves the ...
Johnathan Simpson's user avatar
0 votes
0 answers
49 views

Access is denied in one folder but not in another

I had a number of files that were downloaded from the internet and they were in Folder A. I tried to run a .bat file on them to rename them, but on every single file I got the error Access is denied. ...
Zero Pancakes's user avatar
0 votes
1 answer
119 views

Changing Word document settings in batch

How can I apply some settings to all Word documents in a folder? (including subfolders) For example now I want to change the background color of all my pre-existing Word documents to sepia (which is ...
living being's user avatar
  • 1,086
0 votes
0 answers
520 views

Open Windows 10 VPN via rasdial or rasphone

I'm trying to auto-start a Windows 10 VPN via batch script instead of clicking several times to start it. I tried it with the command rasdial.exe "MYVPNNAME" "USERNAME" "...
Vortilion's user avatar
  • 101
0 votes
1 answer
112 views

How to print list of files without including the txt file?

I've made a bat file that will create a txt file in every subfolder that lists all the files in that subfolder. Is there a way to not include the dirlist.txt file when it prints the list? @echo off ...
TravelWhere's user avatar
1 vote
2 answers
345 views

Command prompt how to exclude windows partition using for loop

I want to list all windows partitions and then exclude partition in which window is installed like (C:\ , it can be any letter) here is command to list partitions for /f "skip=1 delims=" %x ...
Sadam's user avatar
  • 134
0 votes
0 answers
38 views

Avoid output numbers x> in file executing batch file

I have a batch file that execute this @echo off ECHO. > "Salida.txt" for %%G in ("Backup\"*.sql) do osql -S SERVER -U name-P password -i "%%G" for %%G in (*.sql) do ...
raulmd13's user avatar
  • 101
0 votes
0 answers
449 views

Can not run batch file from Run box even after added to Path

I am trying to run a batch file from the Run box. I am very new to Python and going through some introductory courses. It is a simple 'Hello World! batch file called hello.bat: @py C:\Users\user name\...
jamesjrz1's user avatar
0 votes
1 answer
1k views

Batch File to recursively read File Name from directory and input to another command

I have one directory in Windows which has files with certain extensions. I want to read the File Names from the given directory with extension and provide to another command one by one. Below is my ...
Arpit Gupta's user avatar
0 votes
1 answer
81 views

Concatenating inside for loop

I am trying to create folders inside another folder using numbers. The code is below. Now I am checking with echo. But it is printing empty string.What is the mistake in it ? and how to achieve this? ...
prabhakaran's user avatar
0 votes
4 answers
2k views

Batch identify and rename files with no extension

I have a folder of thousands of files in different formats but without any extensions. I know how to detect unknown file types using the tools such as TrID - File Identifier and DROID: file format ...
eArmin's user avatar
  • 111
1 vote
1 answer
1k views

Batch file does not run

I wrote a simple .bat file that appends the string "somethingnew" infront of .txt files: for %%x in (*.txt) do ren "%%x" "somethingnew%%~nx" But when I run it from the ...
Zero Pancakes's user avatar
0 votes
2 answers
2k views

Batch rename multiple files by modification date

I got a bat script for rename files by their creation date but I need to adjust the code below to made to rename files by modification date. @echo off set Folder=%userprofile%\desktop\Images For /f &...
Mechanix2Go's user avatar
0 votes
0 answers
105 views

cdburnerxp with cmd for converting bin

trying to convert bin to an iso with cdburnerxp and keep getting an error. this is my command FOR /r %%i IN (*.bin) DO ("D:\Downloads\CDBurnerXP-x64-4.5.8.7128\cdbxpcmd.exe" --burn-iso -file:...
Johnathan Simpson's user avatar
0 votes
1 answer
2k views

Intune Win32 app batch script installation can't run as user

TL:DR When trying to install and run a .bat script file via intune Win32 app the install behavior is stuck on SYSTEM and greyed out, but the batch script requires to be run as current logged in user. ...
markaabo's user avatar
0 votes
1 answer
148 views

Can be changed to batch file?

I would like to create a .bat file that converts all .png files in a folder into individual .mp4 files that have the same name as the .png file: This converts a .png into a 30s video, however how do ...
john's user avatar
  • 1
1 vote
1 answer
723 views

How do I download the RSS Feed XML file in dos command batch mode?

I have a specific requirement that I need to download the RSS feed file (it is in XML format) from the given link using dos command. I have tried the following command and it keeps giving me syntax ...
Manikandan Arunachalam's user avatar
1 vote
1 answer
614 views

(net was unexpected at this time

I am trying to write batch file to map drive when needed but whenever I run it I get an error: (net was unexpected at this time @echo off SET /P Site=Which site you want to map please type SITE ...
Syed  Asad Haider's user avatar
0 votes
1 answer
993 views

For loop and find command

I'd like to parse out only the line number of find command. Here is my attempt: FOR /f "tokens=1 delims=[" %a IN ('find /n "string" 2.txt') DO @ECHO %a but it returns sth. like ...
Daros911's user avatar
  • 195
0 votes
2 answers
2k views

For loop and errorlevel variable

Having such simple batch script @echo off for /F "tokens=*" %%f in (toFind.txt) do ( find /c "%%f" 1.txt if errorlevel 0 ( echo %%f "--->" found ...
Daros911's user avatar
  • 195
4 votes
1 answer
2k views

Would that be a bug? Immediate closing of the current cmd window when executing: move nul 2>&0

Eventually, I use move nul 2>&0 in my scripts to "abruptly" close the current of the cmd window, and thus immediately abort/close the running bat. I can't say it works like a suicide ...
Io-oI's user avatar
  • 8,243

1
12 13
14
15 16
80