Skip to main content

All Questions

Tagged with
1 vote
3 answers
140 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 & ...
overdriven's user avatar
2 votes
1 answer
93 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 ...
Agodless's user avatar
0 votes
1 answer
91 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 ...
Qwert Yuiop's user avatar
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 ...
Enema State's user avatar
3 votes
2 answers
409 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 /...
Mr.Key7's user avatar
  • 843
0 votes
0 answers
36 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 ...
octalgon's user avatar
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 ...
heyimvic's user avatar
1 vote
1 answer
61 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 ...
Bricktop's user avatar
  • 313
0 votes
0 answers
391 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, ...
Al So's user avatar
  • 1
0 votes
1 answer
170 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-...
nostromo's user avatar
0 votes
3 answers
277 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 ...
Shane Cusack's user avatar
0 votes
2 answers
253 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: ...
Deutsch - Musik's user avatar
0 votes
1 answer
3k 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:...
NTF espolion 307's user avatar
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:\...
arjeplog's user avatar
2 votes
1 answer
1k 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 ...
batchconfusesme's user avatar
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 ...
kerstoff0mega's user avatar
0 votes
0 answers
318 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-...
user avatar
-2 votes
1 answer
568 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 ...
Pacdizzle's user avatar
0 votes
2 answers
771 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. ...
Flaver-D's user avatar
  • 165
2 votes
1 answer
535 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
0 votes
0 answers
169 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
3 votes
4 answers
747 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
1 vote
1 answer
148 views

How can I make a version of this script start up after reboots?

I have this one batch file that runs: for /R C:\some\Directory\target\ %%f in (*.bat) do (call "%%f") It eventually loops over a bat file and has to reboot is there a way for it keeps ...
EnlightenedFunky's user avatar
0 votes
2 answers
82 views

how to add directory inside this power shell script

<# copy desktop.ini recursively #> Get-ChildItem -Recurse -Directory| foreach { copy "D:\Programs\Media\Media Manager\Filebot\cmdlets\desktop.ini" $_.FullName} <# set folder ...
Rami Magdi's user avatar
0 votes
1 answer
2k views

Create a bat file to open multiple projects in Visual Studio Code with one click

I created a shortcut for each of my projects in VSCode to speed up the process of opening them: But if I select the four shortcuts with the mouse and try to open them with the ENTER button, it only ...
Digital Farmer's user avatar
1 vote
1 answer
800 views

Redirecting the output to a file and command prompt simultaneously

Below code is in batch file as i'm running powershell script with batch file. but doesn't give any output. I am trying to use the tee code written for a bat file but am having trouble implementing it ...
Suraj Kumar's user avatar
1 vote
2 answers
735 views

How to quickly determine which files contain only NULLs so they can be safely deleted (Windows)?

A friend has thousands of files that likely contain nothing but NULLs (ASCII 0). (If interested, see this Super User QA to learn why). The files range in size from 650 bytes to ~200MB (with the ...
End Antisemitic Hate's user avatar
0 votes
0 answers
66 views

Loop through .bat location's subfolders, create shortcuts for each .exe, add highest subfolder prefix, save to specified folder

As the title says, but here's an image for a visual explanation. I like the idea of doing this via a batch script. (as I am somewhat familiar with batch scripts and find them quite readable, so that ...
Mica's user avatar
  • 1
0 votes
1 answer
1k views

Rename all file in a Folder

I am trying to rename all the file in a folder using this: @echo off setlocal EnableDelayedExpansion for "%file_path_history%" %%a in (*.*) do ( if not "%~nx0"=="%%a" ren ...
Gimmy88's user avatar
0 votes
2 answers
396 views

.bat file to change file and folder attributes makes my hard disc slow

I had created two files to change the icon of some folders. More specifically, I added one .ico file and then a folder.ini with the following content: [ViewState] Mode= Vid= FolderType=Pictures [....
Datacrawler's user avatar
0 votes
1 answer
397 views

Is it possible to create a single batch file that can remove the contents of a directory and then add new files to it from another directory?

First post here. Is it possible to create a single batch file that can remove the contents of a directory and then add new files to it from another directory? I am using Microsoft flight Simulator ...
Scottish Rebels's user avatar
1 vote
2 answers
403 views

Is there a way to check if something is not in PATH, then conditionally do certain action in CMD?

This works great for downloading 7zr for doing decompression tasks in a batch script if 7z.exe isn't in the working directory. if not exist "7z.exe" curl -L "https://www.7-zip.org/a/7zr....
Mugi's user avatar
  • 21
0 votes
2 answers
430 views

Windows batch file multiple "start" lines interfering with each other

I am trying to use a batch file to quickly start my web app locally because there are many commands to run. I am using the following: start "" /d "%~dp0client" npx webpack --watch ...
Joe C.'s user avatar
  • 101
0 votes
1 answer
4k views

Running a batch script from a network drive

I'm trying to install printers through command line which looks like: start \\servername\\printername I have to run cmd.exe as admin or it won't install drivers. This works well when running it ...
user642958's user avatar
0 votes
1 answer
893 views

How to know if MS Office is installed on Windows and Which version with a Batch file?

I'm asking what the best method to know if the office is installed or not on windows in batch? So, i create this batch file to know which word version is installed ! My Question : Is there any method ...
Hackoo's user avatar
  • 1,404
0 votes
1 answer
45 views

popd not letting open excel in script

@echo off set data_sheet="\\EXAMPLE\module1\Automation\Datasheets\ZXC" set csv_name=%3 pushd "%data_sheet%\%1\%2" start excel "%cd%\%csv_name%" REM need to put ...
zxc's user avatar
  • 1
1 vote
0 answers
354 views

how do I send an HTTP request when my pc goes to sleep or shutsdown

I am trying to set up a system where when my pc goes to sleep or shutsdown it sends an HTTP request to a raspberry pi on my local network which then performs some actions. Currently I have written a ...
Surt McGert's user avatar
0 votes
1 answer
258 views

To kill a CMD session

I use a batch file to countdown and need to stop this countdown process in another batch file. I've tried to use these, but they all failed: taskkill /f /fi "windowtitle eq countdown" ...
VB88's user avatar
  • 423
0 votes
1 answer
2k views

Batch Command to Search network Folder by date modified

I am attempting to find the most recent files in a network folder using a wild card. The code within the batch file is provided below. When the .bat file is executed it returns an error for /f %%f ...
JavaGirl's user avatar
0 votes
1 answer
492 views

How to stop a batch file altogether from a child batch file?

I have a couple of batch files. One is the parent and others are children that are called by the parent. Let's say I have Deploy.bat that calls ExtractParameters.bat. In ExtractParameters.bat I want ...
Ali EXE's user avatar
  • 185
0 votes
2 answers
504 views

Error running and killing then run new batch file on specific time period

Error running and killing then run another batch file on specific time period. Tried to run timeout and CALL simultaneously but I guess there's an error in my lines so it doesnt go through. Since my ....
dawnslayer's user avatar
0 votes
1 answer
1k views

Echo errorlevel description to log file

Forgive me ignorance here. I'm very new to writing batch files. I am copying files from one mapped server drive to a different mapped server drive, and creating a log file after the copy is complete. ...
Oramac's user avatar
  • 1
1 vote
1 answer
729 views

Add file name to beginning and line break at the end of file

I want to add file name to the beginning of every file and line break (-------------------------------------------------------) --> like this --> empty ...
devec's user avatar
  • 113
1 vote
2 answers
1k 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-...
Kovy Jacob's user avatar
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 ...
Sathish Kasinathan's user avatar
0 votes
1 answer
100 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 ...
Travelz Online's user avatar
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 ...
Maverick's user avatar
0 votes
1 answer
205 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 ...
noname's user avatar
  • 103
1 vote
0 answers
386 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 ...
Frdcrls's user avatar
  • 11
1 vote
1 answer
42 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 ...
Nate's user avatar
  • 113

15 30 50 per page
1
2 3 4 5
8