All Questions
Tagged with windows batch-file
1,306
questions
0
votes
2
answers
31
views
windows defender antivirus folder missing on local group policy editor
gpedit.msc was missing, i added it with using .bat
after restart i could enter to gpedit.msc but windows defender antivirus folder is missing
i need that folder to disable windows defender. pls help
...
1
vote
3
answers
139
views
Is there a difference between combining commands with & and running them one at a time?
Say I want to run multiple, computationally complex commands on Windows command line.
Does it makes a difference, performance wise, if I combine them with &:
doSomething1 & doSomething2 & ...
1
vote
2
answers
59
views
Sorting Windows Explorer's file checkboxes output
I'm writing a rough .cmd batch to do an operation with a few files (4 or 5) in Windows. I want to mark the desired files in Explorer's checkboxes, and drag-and-drop them to the batch file, that will ...
2
votes
1
answer
92
views
A batch file with an executable file checks if it is not in the processes in order to run another batch file (or code from it)
There are two batch files. Need to add a condition to the first file if the process is running nvcplui.exe then nothing, and if it is not running, then the second file (or the code from it) will be ...
0
votes
0
answers
50
views
Creating a bat file to force close microsoft excel
First of all, i am sorry if i post this in a wrong community as i am new to this.
So i am trying to run a bat file whenever something goes wrong, the code for the bat file is as follows:
taskkill /IM ...
1
vote
2
answers
127
views
Powershell in bat file closing console
I have a bat file that normalizes several audio files in one folder.
I create txt files with the same names as the audio files and I need to delete some lines from a txt file that will be used to ...
0
votes
1
answer
82
views
Why does an `echo` with brackets `()` break the `if` statement?
The if statement in following code shouldn't trigger, but it does. If I change echo () to echo [], it works as intended. So apparently it has something to do with the brackets ().
set a=1
set b=2
...
0
votes
1
answer
38
views
How to extract a part of a line that is between two specific strings using a batch script [closed]
I am trying to extract strings which are between <meta property="al:ios:url" content="snssdk1180://live?room_id= and " data-rh="true">.
Example Input:
<meta ...
3
votes
2
answers
493
views
Windows Batch Script: how to recursively go through all files except certain file types and folders?
I'm trying to do a replace string operation on all files except those in .git folder and all pycache directories which can appear nested in any nested directory. I'm executing the script in the root ...
0
votes
1
answer
85
views
Copy and rename batch file
1folder (cover.jpg)
2folder (cover.jpg)
3folder (cover.jpg)
.
.
There are so many jpg file with same name cover.jpg in multiple folders.
I am trying to copy and rename all cover.jpg in another folder ...
3
votes
2
answers
406
views
What Equivalent %* of Batch in PowerShell
Batch Script:
@echo off
if not "!!"=="" setlocal enabledelayedexpansion
for /f "tokens=4*" %%a in (
'dir /AD "%USERPROFILE%\" ^| find "DIR" ^| Find /...
0
votes
1
answer
32
views
If I created a task on a user called "A" and I want it to be executed on user "B", how do I do it?
I'm looking for help with "Task Scheduler" Windows 10
I don't know how to do it but basically, I have two users, "A" has admin rights and "B" does not.
I also saved the ....
0
votes
0
answers
34
views
Send input to running program Batch
I would like to start a cmd line program in Batch and be able to communicate with it.
Currently I am starting the program with start /b cmd /c "cli_program.exe" > log.txt. I am currently ...
0
votes
0
answers
29
views
Trying to find .exe over multi drive wide search in a bat file. Tried with relative path commands
As stated in the title I have a bat file set up to locate and run 2 separate exe's. One is located in the same folder as the bat file which for this %~dp0 works just fine. The second exe is one to a ...
0
votes
2
answers
77
views
How can I echo the actual logged in user if running batch as administrator?
I would like to know which user is logged in to Windows from the bat script I launch with right click and "Run as Administrator". If I try echo %username% the script obviously output "...
1
vote
1
answer
60
views
Any way to do a Batch file move operation only when the HDD is idle-ish?
I know how to check if a specific program is running like winrar which might indicate usage on drive d: but is there a better way to determine if a drive is relatively idle enough (via Batch or other ...
0
votes
1
answer
130
views
Windows Terminal: Open cmd.exe then run script
I want to create .bat file to open cmd.exe in Windows Terminal and activate python environment
cd D:\pythonApp
venv\Scripts\activate
this successfully open cmd in Terminal and set the directory
wt....
0
votes
1
answer
246
views
(SOLVED) how to enable and disable device in one batch file [duplicate]
I want a shortcut that enable/disable a network card according to its status. I figured out how to enable or disable using either devcon, wmic and pnputil or found some Q&As here that suggest ...
1
vote
2
answers
198
views
Copy single file in to sub folders of destination root folder
I need to copy a single text file inside a (source) folder in to all (480) sub folders of another parent folder.
To keep it simple (I will amend the correct paths later) as I try to work out how to do ...
0
votes
2
answers
334
views
Xcopy: Copy last modified file from folder
I need to copy the last modified file of a particular extension from a folder. For example a folder contains:
File1.cas
File1.txt
File2.cas
File2.txt
File3.cas
File3.pptx
...
File100.cas
File100.pptx
...
-2
votes
1
answer
66
views
Improve bat script
I'm try to improving this and make it looks better. I have two issues
When I run as administrator the file that I need won't copy in the user profile (I just run as admin to run the .bat script.
...
0
votes
0
answers
104
views
Display switch with a timeout in a Batch script
I have my PC connected to my monitor and TV. I want to be able to switch my display to the TV and launch an application through a script.
As I do this, I would like to set the audio to be the TV ...
0
votes
0
answers
382
views
Running a batch silently, but how can I get process ID to show a specific name?
I have followed this here to run a batch file silently, in the background and doesn't show on taskbar, it's great.
How to run a batch file without launching a "command window"?
The thing is, ...
1
vote
1
answer
98
views
Weird effects when one CMD script runs another, from inside a function
When one BAT or CMD script runs another (without call), that should not return, right?
It sometimes does!
And it searches the same function label in that other script?!?
Example: (what do you think ...
0
votes
1
answer
168
views
"dir like" sorted by time in a batch file (.bat) using a piped string command: Get-ChildItem | Sort-Object -Property LastWriteTime, not working
I'm trying to build a trivial batch file in Windows for command line to execute a "dir like" command to list the directory contents sorted by time, avoiding typing: Get-ChildItem | Sort-...
0
votes
3
answers
270
views
Batch script to take first & second part of folder name and create new folders from them
Any wizards out there that can help with this?
I have some music folders labelled like this "Taylor Swift - 1989" etc with just the music files and folder image in the one folder.
I need ...
0
votes
2
answers
227
views
Windows taskkill not finding titled cmd.exe
I'm starting a lot of .bats, in which I execute, for example:
title Waterfall-Proxy
I do this, to have an easier closing the right cmds when I want to shut them down.
To shut them down, I'm using:
...
0
votes
0
answers
149
views
Switch screen being mirrored by command line
In my setup I have two monitors stacked vertically, and a TV, hooked up to my PC. The TV mirrors the top screen usually. I want to write a script (so that I can set a keybind) to switch the screen it ...
0
votes
1
answer
2k
views
How to verify if a variable is equal to an other variable or a Windows variable in batch files?
I am making a "locked" batch file that only certain user can use so what I am doing right now is to check the condition if what the user write is == to %username% or other variable like this:...
2
votes
1
answer
647
views
MultiMonitorTool.exe questions
I am using Multimonitortool.exe to switch between displays, to be precise: i got 3 Monitors, while Monitor 1 and 2 are permanentely on and Monitor 3 is turned on only when i need it. If i need it, ...
0
votes
1
answer
130
views
Mounting dropbox as a network drive and running a batch file on it
I have Dropbox set as a network drive drive letter X: with all my channel logos and EPG Data Generator program and scripts for creating an XML EPG File for Tivimate. This drive also has the XML EPG ...
0
votes
2
answers
8k
views
Using a .bat file how do I copy a file from its current directory to another directory?
I want to be able to have the batch file in any directory and have it copy the file to the specified directory. I have tried using:
set path="%~dp0"
copy "%path%\test.txt" "C:\...
0
votes
1
answer
285
views
Use WinSCP or any other program (cmd) to download from SFTP [closed]
How to use WinSCP or any other program (from command-line) to download files from SFTP with authorization key?
This is for Windows versions 10 and 11. I am trying to download files from command prompt ...
2
votes
1
answer
990
views
How to index into array with variable in batch?
I'm trying to process input arguments to a batch file, and I need to tie some paired arguments together before I call an executable at the end. I'm placing all the arguments into an array so I can ...
5
votes
2
answers
2k
views
How to run python from Windows cmd?
I make a lot of python scripts - like blah.py, in my scripts directory, which is in the path. I want to just type "blah" to execute blah.py.
but when I do - the file opens in visual studio ...
3
votes
1
answer
3k
views
How can I use Windows .bat files to create folder above current folder?
I need to make a .bat file for many people that would be placed in a specific folder and then move specific files from said folder to another folder above the current working directory.
I don't have ...
0
votes
3
answers
675
views
How can I monitor a specific directory in Windows 11 to see when a new file is added?
I have a shared folder within my company that often gets new builds added to it. It is my job to do QA on the builds in that folder but I am getting tired of just having to check the folder every day ...
0
votes
0
answers
105
views
Scheduling Batch scripts WIndows , how to
I have a batch script shortcut that I put into the start-up folder .. This successfully runs a RWeverything command at boot .
Rw.exe -/Min /Nologo /Stdout /Command="WRMSR 0x610 0x0 0x005F8A00 0&...
0
votes
0
answers
310
views
webDAV "net use" .bat not working with password
I'm trying to set up a net use .bat file to automatically map a webDAV-folder on Windows-boot, but I can't, for the love of god, make it work. I tried like 30 combinations suggested on the Windows-...
-2
votes
1
answer
563
views
Batch file to rename and move file to parent directory
I have a batch file that renames the first file in a folder to the name of the folder it's in and move that file to the folders parent directory.
The problem I'm facing is that if there are multiple ...
-1
votes
3
answers
172
views
How to modify this .bat file to include the name of the parent folder?
I've created this .bat file and added it to my context menu to help me quickly create a set of folders with predefined names when I'm starting a new project, this saves me time from creating all these ...
0
votes
2
answers
762
views
Download from github using curl and batch file
I'm currently writing a script in which I need to download the latest version of yt-dlp.exe from Github.
Since the script will need to work on multiple machines, I opted to use curl as the downloader.
...
2
votes
1
answer
857
views
Java JDK installation per cmd on Windows machine
How can I install a JDK via cmd or with another file?
I have to reset my Windows PC regularly for security reasons and I don't always want to go through the setup menu.
A Batch or CMD file to install ...
0
votes
0
answers
69
views
create a single task user in windows
I have a program that I want to run automatically whenever a specific user logs in to their Windows account.
Additionally, I only want my program to run and nothing else, like the desktop or Windows ...
0
votes
0
answers
382
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:
...
0
votes
2
answers
467
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} \ {...
1
vote
1
answer
134
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?
-1
votes
1
answer
200
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 ...
1
vote
2
answers
566
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/...
2
votes
1
answer
527
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 ...