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,073
questions
0
votes
1
answer
965
views
APPDATA in .bat or .cmd does not print proper name with space
I have different users that have name with space and no space : John Doe, Jane Susy
I tried typing %APPDATA% in command prompt, and all i get is John / Jane.
How should i script my batch/cmd file, so ...
0
votes
0
answers
122
views
Merge the multipage tiff in subfolder to another output folder as single image
Iam trying to merge the multipage tiff in subfolder to another output folder as single image.
the base command is convert f:\input*.tif f:\output\image1.tif
My question : Iam getting no output. What ...
0
votes
1
answer
108
views
Replicate GUI behavior when opening an explorer window with command line in Windows 10?
If I double click a shortcut to a folder and open that folder, then I double click the same shortcut again, Windows doesn't open a second instance of the folder, it activates (or maximizes) the folder ...
0
votes
1
answer
566
views
need to create a batch file to run at logon of each user to check for folder with its user ID in path & create if not ther, apply full control to user
This script creating folder but it is applying permissions to all the users who ever logged into the server.
if not exist \\xxxxxxx\userhome$\%username%\ mkdir \\xxxxx\userhome$\%username% || goto :...
0
votes
0
answers
449
views
copy files using listed in text file, how to copy files and with folders and it's subfolders
I want to copy several files listed in file.txt file.txt` file contains the relative path:
web/main/src/web/login.txt
web/main/src/ht/pro.i
web/main/src/log/ss.p
When I run the following script:
@...
0
votes
1
answer
11k
views
.bat file to change windows password
Reference Image
Is there a way to automate the process of changing the windows password using a .bat file.
The traditional way of changing the password will be like.
Open Command Prompt, type net ...
1
vote
2
answers
934
views
Powershell commands aren't running in CMD or .bat
I am trying to put 2 powershell commands into a .bat file so I can just click on the file and run them, without opening powershell, pasting in the commands, etc.
The commands are:
cd Downloads
get-...
2
votes
3
answers
1k
views
"sendto" all selected files into a folder
I found this lovely time saving script which has helped me a lot.
@echo off
cd /D "%~dp1"
md "%~n1"
move %1 "%~dp1%~n1"
Script found here Application that will move file ...
1
vote
1
answer
1k
views
Skip a command if it is stuck and continue with the next command without terminating batch job in windows batch script
I have a batch script with multiple commands running sequentially.There is one particular command which takes longer occassionaly(sometimes even stuck for hours). I want to skip this command if its ...
0
votes
1
answer
287
views
How to skip argument/parameter when copying files in a batch script?
test.txt contains 4 files with relative path:
"brazil\206\tri\read.txt"
"brazil\206\tri\log.i"
"brazil\207\pass\prog.p"
"brazil\206\bin\read.xml"
Using ...
1
vote
1
answer
1k
views
How do I incorporate specified path in batch file for ffmpeg for each?
If I use this using CMD within the directory where all the movies are, it works fine:
for %i in (*.mp4) do ffmpeg -i "E:\%i" -map 0 -c copy -metadata:s:a:0 language=eng "E:\converted\%~...
0
votes
0
answers
43
views
cmd array populating empty EDIT multi dimensional [duplicate]
This is giving me little headache.
I fillup an array with ip adresses and hostnames. When filling the array the corresponding element shows added to the array.
Data for sentinels.txt:
127.0.0.1 ...
0
votes
1
answer
99
views
Batch file to use different cmd step by step
I was creating a batch file to continuously work on few process.
first I have to create 3 separate folders based on input folders/subfolders
than use copy cmd from folder 1 to folder 2
than ...
0
votes
1
answer
13k
views
windows batch. Checking for a substring in variable gives error. Needs Escaping for space
From https://stackoverflow.com/questions/7005951/batch-file-find-if-substring-is-in-string-not-in-a-file, I figured how to check if PATH variable has a certain substring(groovy's path). However, my ...
0
votes
0
answers
2k
views
Need .bat script to copy file to multiple pcs
I have a requirement that I need to copy a file to multiple PCs frequently. It has to first check if the file exists, if yes then rename it with DATE and if no, then copy.
I prepared a txt file with ...
5
votes
1
answer
521
views
How to run a MS-DOS/Win9x batch file containing CD while preserving the original working directory?
Consider the following batch file test.bat:
CD C:\SOFTWARE
program.exe
This script is run from C:\ELSWHERE
C:\ELSWHERE> C:\test.bat
After the script exits the current working directory is now C:\...
0
votes
0
answers
441
views
Batch file that launch admin login window with Menu Options, unable to open urls on Chrome/MS Edge
I tried a batch file menu options with a prompt to enter admin password after clicking the bat file icon. But I noticed on the Menu options where it should open multiple websites on chrome, it was not ...
3
votes
1
answer
1k
views
NirCmd volume control of certain applications from Volume Mixer not working?
So I use this app to mute microphone communication in Valorant.
But I also want to mute the game itself.
The devs of the game have separated these 2 so in Volume Mixer (SndVol.exe) they are 2 ...
3
votes
1
answer
7k
views
How can I echo %errorlevel% in batch?
I want to do something like:
echo %errorlevel% > error.txt
which would save in error.txt:
%errorlevel%
0
votes
1
answer
199
views
Send to C:\<copy path>\Develop batch
Using Windows 10 if possible, I'd like to be able to send from my local host to my git development path using the Send To context menu.
(Win + R, shell:sendto)
I have two directories lets say they ...
0
votes
1
answer
650
views
Is there an easy way to bulk swap the file names of two files in Windows?
Is there an easy way to bulk swap the file names of two files in Windows?
I have File_A.txt and File_B.txt and after the operation, File_A.txt is now called File_B.txt, and vice versa.
:: Old Name ...
0
votes
0
answers
867
views
Edit Windows 10 boot config (BCEDIT?) to disable Safe Mode
I recently had a weird issue where while using my Windows 10 laptop that had been working fine, suddenly I couldn't create folders anymore, neither in GUI nor CLI (command line). My laptop display ...
4
votes
3
answers
3k
views
How to convert multiple .reg files for use in a single .bat script?
I have three .reg files and need to use them in one .bat script:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA&...
1
vote
2
answers
334
views
Move folders to new folders using part of the original folder name with delimiter
I'm trying to move folders into new folders based on the last part of their name. The delimiter is an underscore. The number of underscores in the folder names vary wildly. I found code that uses the ...
2
votes
3
answers
2k
views
How to suppress Windows batch job termination confirmation?
When a Windows batch job has launched a program (executable), the user may press Ctrl-C to stop the program.
This causes Windows batch job to show "Terminate batch job (Y/N)" prompt and to ...
0
votes
1
answer
1k
views
How can i set a time limit on set /p in Batch?
I've been trying to find out how to set a time limit on a "set /p" in Batch for like 30 minutes and still
couldn't find out how..
set /p example=
i want this code to exit if it passes 3 ...
0
votes
1
answer
871
views
Remove file extensions with "echo match extension" in a Batch script?
I have this batch script:
set driveletter=F
call :delext "*.foo"
call :delext "*.bar"
call :delext "*.pdf"
:: funcion delext
@echo off
pause
goto:eof
:delext
set ...
1
vote
0
answers
366
views
How to stop a process from starting using a batch file?
I've been trying to find a way to stop a process from starting using a batch file. So far I've had no success.
I know I can use taskkill to kill a process that's already running, but I want to stop it ...
1
vote
1
answer
41
views
bat filename not what is expected
I am writing a bat script to create a project directory and then create dotnet projects. In the script, I try to access the csproj file through referencing it. The issue that I am having is that the ...
1
vote
0
answers
241
views
How can I change playback device "default format" using a batch file?
I'm having issues with my speakers where they will crackle randomly until the audio format is changed. (I go back and forth between both studio quality options) The crackling can start as frequently ...
0
votes
1
answer
158
views
Remote update of MS-Access frontend applications
We are doing quite many changes in our ms-access front-ends, so we need to update the ms-access applications often. I have tried to use PSEXEC for the remote updates, but it seems to be a problem with ...
0
votes
0
answers
4k
views
GPO: Run batch script as local administrator (NOT system) during system startup
This might have been answered before, but I was unable to find a clear answer to my specific issue.
I'm trying to run a batch-script that will trigger installation of a custom written Windows Service ...
0
votes
1
answer
189
views
Remove .txt extension from all subfolders
Is it possible to create a batch file that removes all instances of .txt extension appearing? I tried the following, but it doesn't work for me.
for f in *.txt; do mv -- "$f" "${f%.txt}&...
0
votes
1
answer
2k
views
Accessing windows credential manager using batch scripts
I'm trying to access the NAS shared path credentials stored in windows credential manager. Is there any way to access those account details directly in batch scripts. Like to integrate batch scripts ...
1
vote
1
answer
244
views
Reimplementing lrzip decompress on Windows explorer using WSL
I've downloaded an old version of lrzip decompressor for windows and noticed that it's using the cygwin libraries in order to run the program itself.
The benchmarks comparing WSL2 and cygwin say that ...
0
votes
1
answer
37
views
Passed executable path not obeyed by Windows START command
In the Windows command prompt I run
"C:\foo.exe" file.asdf
Then foo.exe is opened.
However, if I run:
start "C:\foo.exe" file.asdf
Then bar.exe is opened.
bar.exe is defined as ...
0
votes
3
answers
8k
views
Batch script to create folder with date and subfolders
So I've managed to make a script that creates a folder with a date with the following:
@echo off
for /f "skip=1" %%i in ('wmic os get localdatetime') do if not defined fulldate set fulldate=%...
1
vote
1
answer
530
views
DOS batch file to display netsh channel output
I'm trying to get wifi Channel output from netsh command to be 2.4GHz or 5GHz
The following provides me with Channel output:
netsh wlan show interface name=Wi-Fi | findstr "Channel"
Output ...
1
vote
2
answers
495
views
Batch move files to different subfolders
I've about 600 files that I want to move to different subfolders based
on the number at the beginning of the filename.
E.g.
5--US-L.jpg -> subfolder /5/5--US-L.jpg
7--US-M.jpg -> subfolder /7/7-...
1
vote
1
answer
86
views
Rename files to grandfather folder name
So I have a bunch of folders with similar directories to the below:
.\page\1\randomStringofCharacters\randomStringofCharactersAgain.png
.\page\2\randomStringofCharacters\randomStringofCharactersAgain....
3
votes
1
answer
4k
views
Cut off from beginning to key frame using FFMPEG
How to cut away a piece at the start of video from beginning to the next key frame?
I know the -ss option
ffmpeg -y -noaccurate_seek -ss 00:00:30 -i "%%~ni.mp4" -avoid_negative_ts make_zero -...
1
vote
1
answer
104
views
Routinely Back Up Single Windows XP Folder to Network Drive
The company I'm at is using a piece of hardware running with a Windows XP program called OldXpProg. Looks to me like the program has hard-coded C:\OldXpProg... callouts throughout it (installs outside ...
2
votes
1
answer
153
views
ffmpeg : Not keeping original codec for Audio Track
I have 3 versions of the ffmpeg command and none of them are perfect... I am stuck.
Below are the examples I have and the issues I face with each version:
ffmpeg -i "%%a" -map 0:v:0 -map 0:a:...
0
votes
1
answer
967
views
Delete folder in registry entry
I have a question regarding the problem of deleting a folder of a registry path with a .bat or cmd shortcut, preferably a .bat.
Here is my problem:
I want to delete (for example) the folder "...
2
votes
1
answer
602
views
Batch file to recursively mux .mp4 and .srt from different folders
There is a new trend in torrents to release TV and Movies as x265 .mp4 with .srt subs in a separate folder, following this folder structure:
Season1\title1.mp4
Season1\title2.mp4
Season1\title3.mp4
...
0
votes
1
answer
2k
views
Start Django App When Windows Starts
I would like to start a Django App automatically when Windows starts.
I created a .bat file (that I intend to execute using Task Scheduler) containing the following:
C:\Users\HP\project-name\Scripts\...
0
votes
2
answers
391
views
PowerShell hangs when command saved to environment variable
This Windows batch script works:
set MTCH=TOP = .
set REPL=TOP = %ProgramFiles%
powershell -Command "(Get-Content -raw Makefile.msc) -replace '%MTCH%', '%REPL%'" >> Makefile_.msc
...
1
vote
1
answer
17k
views
Set variable from exe output using batch file
I want to check Edge webdriver version using batch file. The name of the webdriver is msedgedriver.exe and I can check the version using this command manually.
msedgedriver.exe -v
And the output is
...
0
votes
1
answer
865
views
Running a Script in Foreground Without Login at Boot Windows10
I am trying to run a programme (t-rex, mining soft) which runs in the cmd indefinitely.
I want to run it at boot without login.
I have got it to run without any problems by scheduling a bat file, but ...
1
vote
1
answer
3k
views
How to launch an app from a minimised Batch File so that it is in focus?
Consider the following code:
timeout /nobreak 10
start notepad.exe
timeout /nobreak 5
if I run it in a focused Batch File then Notepad launches as the active window. If however I minimise the Batch ...