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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
112 views

Extend to Display and switch to this Display as Main Display via .bat File or similar [duplicate]

I am using two monitors that are constantly active, a third one is only occasionally active. When i use it, i have to extend to this display (its labeled Monitor 2 then) and make it my main display. ...
PBR91's user avatar
  • 23
0 votes
0 answers
935 views

How to zip multiple folders in a directory separately

There are multiple folders in a directory which I want to zip individually with original FolderName.zip and after they are zipped delete the original folders. There are other zipped folders already ...
Afzaal Ahmad's user avatar
0 votes
0 answers
299 views

Why does regedit.exe have HKCU permission for importing but reg.exe does not?

I have a .reg file with current user values. If I use reg.exe in a bat file to import it says: ERROR: Error accessing the registry. If I use regedit.exe there are no issues. For regedit.exe I use: ...
subjectivist's user avatar
0 votes
2 answers
417 views

Recursive directory rename with subfolder level control

My Challenge: Recursively renaming the 3rd subfolder {subf3} and beyond {subf4, 5, 6, ...} of a root path to keep only the first 4 characters of their original folder name. e:\ {rootf} \ {subf1} \ {...
ElmerF's user avatar
  • 23
0 votes
1 answer
2k views

PowerShell start-process -argumentlist: does not work with cmd.exe but works fine with notepad.exe

I'm scripting a .bat file for an event scheduler but I'm having a problem. start-process notepad.exe -argumentlist 'C:\test.bat' -verb runas this works start-process cmd.exe -argumentlist 'C:\test.bat'...
근육질푸키's user avatar
1 vote
2 answers
1k views

How to sort the files which are returned by findStr command, by modify date?

Currently, I need to find out all the files which contains the key word. Here is the command I am using findstr /s /i "my-key-word" *.*. How can I sort the returned files by its modify date? ...
Robin Sun's user avatar
  • 121
0 votes
0 answers
250 views

Converting batch file to exe for Windows Embedded Compact (XP)

I’m having some trouble trying to create a very simple .exe file that starts a .url file in the same directory, when I try to run it, a pop-up message shows an error telling that: “<filename.exe>...
AleDetto's user avatar
1 vote
1 answer
54 views

Batch File for Tax year April to March

I am trying to make a batch file to create 12 folders starting in April and ending in March. I don't know how to make the date entered go to set year1= or how to make the date set year2 1 year later. ...
Alan-53's user avatar
  • 33
2 votes
3 answers
194 views

Seemingly impossible to extract URL string in between two text delimiters from 100's of messy Google News Alert emails with batch

For years Google News Alerts has sent daily emails when certain words pop up in websites, tweets, etc. and these emails (in HTML and .txt format) have one unique quality: there is no easy way to pull ...
user1798732's user avatar
1 vote
2 answers
1k views

batch script - How to conditionally redirect output stream(s)

In summary, the goal is twofold: Create a logfile that only contains commands that have failed, plus the error messages those commands generate. Prevent console output (success or failure), except ...
Paul π's user avatar
  • 216
1 vote
1 answer
125 views

How can I debug Binary batch file?

I have a .bat file in binary format. But I don't know its functioning. How can I view the content in detail or debug the binary .bat file, or convert it to exe file?
Bernd Groger's user avatar
-1 votes
1 answer
182 views

Cant choose "tag" after Tag_Folder.bat

I found this great answer that shows how to add tags to folders on Windows 10 but unfortunately it does not work as expected. If I right-click in a folder I can enter a tag but the problem is that I ...
LulY's user avatar
  • 99
-1 votes
1 answer
784 views

How do I take contents of a file and to move it to another in batch script?

I am trying to made a batch script that the user types in the two file names they want to merge and then leaves them with a merged file. I already made it merge I just need to know how to copy the ...
Ethan Cato's user avatar
1 vote
1 answer
58 views

Do actions executed by .bat files get affected by UNDO/REDO functions

I often use .bat scripts that delete, copy, paste, rename, or move files. I'm not sure that when I execute one of these .bat scripts that I will be able to use the Windows Explorer 'Undo' function (...
Kalamalka Kid's user avatar
1 vote
2 answers
452 views

Taskkill harming things or not?

So I know that ALT+F4 can close a program. I know that Task manager can close a program and I am aware that taskkill can close a program. What I am curious about is if you close programs/games/...
GODSEND's user avatar
  • 13
0 votes
0 answers
94 views

Batch script error image upload

Wrote a batch script file that uploads an image to smugmug using the smugcli cmd tool in Python. Now I'm getting an error creating an album. I think it has something to do with the special character ...
BertW's user avatar
  • 1
1 vote
1 answer
408 views

Install Windows cmd in WINE

CMD implemented by WINE struggle to run complex batch scripts, I think it is possible to overcome by installing CMD.exe from Windows, but upon executing anything in it gives different meaningless ...
nonForgivingJesus's user avatar
1 vote
2 answers
563 views

How do I create a better drag and drop .BAT file that processes as many files as I select?

How do I create a better drag and drop .BAT file that processes as many files as I select? The purpose of this batch file is to convert any file with sound on it (mp3, ogg, mp4, etc) to a wav. I want ...
sp1792407's user avatar
2 votes
0 answers
787 views

How to automatically disable "Allow computer to turn off this device" on all devices in Device Manager

I need to frequently go through most devices and disable this option (if the Power Management tab is available) for clients machines (Win10/11). Don't mind how it's done, Powershell/batch/VBS/etc. I ...
Nathan's user avatar
  • 43
0 votes
1 answer
881 views

how can we sort files according to their size using cmd batch files and print a wait timer till the loop is running?

How can we sorting the files with size in the decreasing order. What should i add ? for %%d in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( if exist %%d: ( echo Another process is ...
user avatar
1 vote
1 answer
255 views

does batch program support any ascii characters or is there's a way to create encoder and decoder program with another tools?

i wrote batch encoder and decoder from adrianvdh and customize some of the text string input, but the decoder one aren't working, because i put special symbols inside there. here's the string of the ...
user avatar
1 vote
2 answers
606 views

Batch processing stdin lines with Windows batch .bat script

I have a Windows batch script delete.bat with that contents: @echo off takeown.exe /A /R /F %1 icacls %1 /grant Administrators:(OI)(CI)F /C /T /Q /L rmdir /S /Q %1 echo %cd%\%1 >> "C:\...
Chameleon's user avatar
  • 207
5 votes
3 answers
3k views

Dynamically change terminal window size on Win11

I have an application that expects exact terminal window size. On Win10 I use the following batch script to start the application: @echo off mode 96, 50 py main.py pause When I used the same script ...
Marko Gulin's user avatar
0 votes
1 answer
811 views

Use Domain GPO to run local batch file on logoff - Is it possible?

What I want to accomplish: When a user logs off a machine and is not on the domain, the contents of the recycling bin are deleted. How this is currently done and works on domain: Domain GPO > User ...
DeltaSun510's user avatar
0 votes
0 answers
146 views

Batch Script For Loop to Websites with user input

I'd like to run a batch script on Windows that will prompt users for input (a list) that is then used to open up all the websites as tabs in one window (like a for loop) (not sure if this question ...
Mary Sojka's user avatar
1 vote
1 answer
35 views

I have a Text file that contains paths and filenames, I want open explorer to each one

I have a Text file that contains the following information: X:\Mr.Wizard\Desktop\Calibration Instruction\CUP CALIBRATION.doc X:\Mr.Wizard\Desktop\Document\Instruction\Variance.doc For the life of me, ...
user1786072's user avatar
0 votes
1 answer
210 views

Is there a way to change the encoding in which the "test.txt" file is created to UTF-8 in a Batch file?

My goal was to make the "test.txt" file create it with "UTF-8" encoding instead of creating it in "ANSI". I leave attached the whole batch file: @echo off cls break > ...
Mirko Nastasi's user avatar
0 votes
0 answers
78 views

Can I move files into just partly same named folder in Windows CMD automatically?

I'd like to move files into partly similar folders automatically with Windows CMD batch. First, there are several files like below. 29100.txt 29103.doc 30011.ppt 30013.txt 40100.xls Second, each ...
Novice_Extremely's user avatar
2 votes
1 answer
452 views

How do I add a register in windows via .bat or .reg file in HKEY_CLASSES_ROOT for web apps to acesss it?

Context: We have some third party desktop applications installed on our users machine, and we would like to open them through our web applications links. I know how to create a URL Protocol manually, ...
Douglas Vicentini's user avatar
0 votes
1 answer
61 views

Does the batch command "ren" cause write operations on disk?

Problem statement We are using a batch-script, part of which is using the ren command to rename a file. This script is ran once per second, possibly even at a higher frequency than that in the future. ...
Koenigsberg's user avatar
0 votes
3 answers
909 views

Is there a simple way to uniformly get the path to 64-bit System32?

I have BAT scripts that I sometimes run on my own computer from 64-bit cmd.exe, and also it has to work correctly on a build server that is a 32-bit process. The problem is that the script needs to ...
Violet Giraffe's user avatar
2 votes
2 answers
545 views

Windows 11 DOS FOR/IF

I am trying to include in a batch file a check to see if a java process is already running before attempting to start it. I have the following working command: FOR /F "tokens=*" %g IN ('wmic ...
Gavin Baumanis's user avatar
0 votes
2 answers
430 views

Registry Query for batch script

I am trying to create a batch script, (only specifically batch script), to check if the latest Microsoft Office version is installed to my computer. If it detects the latest version, it will output ...
Tom Sim's user avatar
2 votes
1 answer
74 views

Need help echoing audio sound cards to a text file in a dos bat

I have 8 sound cards installed and am trying to create dos code to dummy echo all the sound card exact names to text file. But ffmpeg won't echo output to a file . Here is what I have tried, and not ...
degarb's user avatar
  • 31
0 votes
0 answers
246 views

Writing a .bat file that will delete orphaned registry keys in the profile list and it is not working as expected

Need to write a .bat file that will loop through HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList, check if the SID actually has a user folder on the machine and if not, ...
Matthew Malone's user avatar
1 vote
0 answers
257 views

Passing User Input to EXE using "Start" and set priority

I have a batch file input.bat I use to start an executable and pass in user input like so: foo.exe < userInput.txt I would like to run foo.exe in a high priority mode, which I can successfully do ...
user973995's user avatar
0 votes
1 answer
101 views

How to get a results ouput file from running a copy operation against a server list?

We have a batch file that we use to (robo)copy scripts to various computers on our network. We need be able to write the result of the copy operation (success or fail) to an output file including the ...
juvenal's user avatar
  • 53
1 vote
3 answers
731 views

Run Cisco VPN in Batch mode

I have made a bat file to connect to Cisco VPN with a properties file that contains the required parameters and it is working fine. However,now a new step is added which is enter an OTP received by ...
osfar's user avatar
  • 111
0 votes
1 answer
217 views

Can these bat/ps1 files be modified to open a folder on a MTP device (my current bat/ps1 scripts already work to copy mp4 files)

I am using the following .ps1 script and .bat file to copy MP4 files from a folder on my phone that's an MTP device with no drive letter (hence the need to use Powershell). I want to modify the ...
bat_cmd's user avatar
  • 541
1 vote
0 answers
281 views

Move multiple pdf files to folders with same name [closed]

All, I would like to set up a script to move pdf files from one folder into their corresponding folder that is setup inside another folder. The pdfs are invoices that get saved with a PO name ex: ...
NHenderson 's user avatar
2 votes
1 answer
169 views

Windows 11 changed Finnish date format to not include weekday, now my batch scripts won't work

I have this script that relies on getting the current day of the week from the command line.. if "%date:~0,2%"=="ma" set "weekday=true" & set "hangday=false"...
Bricktop's user avatar
  • 303
3 votes
4 answers
649 views

Delayed Expansion in a for loop processing paths that contain exclamation marks

I know there are already a few questions here about this same issue but I am new to batch scripting and I found those solutions hard to apply in my scenario or directly not applying to my script. A ...
diegopau's user avatar
0 votes
1 answer
2k views

How to send an input (letter y) after the command requests me to

I am trying to do chkdsk C: /f /r /x After I do this command, It requests me to press y to accept checking my disk after restarting my pc. How can I automate this for my .bat file? I mean, after the ...
fatFeather's user avatar
3 votes
1 answer
1k views

How can I set different wallpaper for dual monitor in win10 with batch file

I have dual monitors, and I want to set different wallpapers for each monitor. Bing wallpaper always change both of them, so I wonder how to write a .bat to update wallpaper for my monitor 2 and do ...
Try2079's user avatar
  • 31
1 vote
0 answers
822 views

I want to run a batch file without start up and without task scheduler

well to put it in simple terms, I have a batch file ready to run on log-on. I tried to put it into the system files to keep it present when changing users (I do not have admin controls which is why I'...
Justin Neugebauer's user avatar
1 vote
2 answers
234 views

Copy multiple files/filetypes - from different folders (list of paths) - to a other folder

Like the title says. I found this here: https://stackoverflow.com/a/1294140 set dSource=C:\tmp\Aufgaben\Tom VPKs set dTarget=C:\tmp set fType=*.eps for /f "delims=" %%f in ('dir /a-d /b /s &...
Omniscient...NOT's user avatar
0 votes
0 answers
59 views

Extract from the second directory

I'm working with the below bat file, and I can't seem to extract the .7z files and skip the first parent folder in the .7z. For example: sales2015.7z file has the below directories sales/engines/parts ...
user1061696's user avatar
0 votes
2 answers
1k views

Need a Windows batch file that will add string to each line of a dir command to produce a file list

I am working with the Informatica platform that only allows me to use batch files. I am currently producing a list of file names with the command dir /b /a-d 850_B_4545703_.txt 850_B_003029660_.txt ...
Kram_Koorbse's user avatar
0 votes
0 answers
102 views

Why would a batch file application (which runs dll) have different resolution when run on VM?

Hello Everyone I am new to this platform and I am in the learning curve (dll or batch files). I have an application created by a third party which contains bunch of dll's and a windows batch file ...
Mubeen Devops's user avatar
3 votes
0 answers
449 views

Open email folder in Thunderbird (v102.7.1) using the windows command line

I'm trying to open a specific email folder in Thunderbird (v102.7.1), using the command line arguments. I already found out that using thunderbird.exe mid:<MESSAGE-ID> will open the email with &...
username's user avatar

1 2
3
4 5
62