Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
64 views

How to change file path in BAT file based on the current user?

I have a bat file to run some Python code similar to this: @echo off set /P State= Select State: set /P Year= Select Year: "C:\Users\MYNUMBER\...
Jwem93's user avatar
  • 109
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 & ...
overdriven's user avatar
0 votes
1 answer
72 views

Batch command with quotes fails to move files and delete folder with special characters

I have a custom batch program that I update and run to negate having to constantly waste half an hour just to clean up the Windows start menu every time I'm forced to reinstall Windows. It saves me a ...
John's user avatar
  • 2,147
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 ...
Agodless's user avatar
9 votes
3 answers
1k views

Why does Windows command prompt command chaining not short circuit when a batch file returns non-zero?

The first premise is that batch scripts will execute all commands in them, even if one fails. @echo off does_not_exist.exe also_does_not_exist.exe C:\Users\user>two_failures.bat 'does_not_exist....
douggard's user avatar
  • 191
1 vote
3 answers
167 views

Powershell - keep only lines in txt files contain some selected words

I have a txt file and I would like to keep only a few lines in it I want to a command that turns this txt file: ;FFMETADATA1 title=TNT disc=01 comment= lyrics-eng= \ \ \ album=Classic genre=Older ...
Clamarc's user avatar
  • 663
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
0 votes
1 answer
227 views

Back from Elevated Admin to Not Elevated

When running Batch Script with Administrator privileges, how to back to not Admin? I tried this example: @echo off :Demo CLS fltmc >nul && (echo Admin& set $A=y) || (echo Not Admin&...
Mr.Key7's user avatar
  • 823
1 vote
1 answer
67 views

Remove Empty Line at Top Command Prompt Start Up Display

This question is a continuation of post Modify Windows CommandLine Start Up Text After I succeeded in modifying the cmd startup display from its origin, so that it looked like this: CMD: Still there ...
Mr.Key7's user avatar
  • 823
0 votes
2 answers
75 views

Getting Two Character Variable Without Pressing Enter (PowerShell/ CMD)

Bash Script: #! /bin/bash read -n 2 -p '2 digit:' ans; echo $ans When i finish input two character, the script continue, without waiting me to press enter. And what I have pressed saves to the ...
Mr.Key7's user avatar
  • 823
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 /...
Mr.Key7's user avatar
  • 823
0 votes
0 answers
32 views

scheduled batch file stops running and reports error

I have a batch file that contains the following line: @robocopy E:\ G:\ /DCOPY:DAT /xd $* syste* /xf ~* /s /xo /np /copyall /log:c:\back-EG.txt It is scheduled to run on the first day of month. I ...
joehua's user avatar
  • 287
0 votes
1 answer
97 views

Batch script and get the output value of a found key

All works fine in a CMD prompt, but, I need put in a bat file to run, but cannot get the output of the Reg Query cmd, and then run another query from that. Since what I am looking for is an App ID, ...
LuckyCharms's user avatar
0 votes
1 answer
179 views

batch findstr not working with string saved in a variable

I'm trying to find a string inside a file.txt using findstr and I have the following issue: set "log_file=C:\Tools_Dev\log_file.txt" a-findstr C/:"text to find" %log_file% works ...
Fernando Lisa's user avatar
0 votes
1 answer
265 views

What secure erase in the fastest way on Windows 10 with cmd? [duplicate]

I have a program in QT, C++ and I want to secure erase the computer after a trigger. After this process, I do not want the old data on the SSD to be accessed by data recovery programs. I want this ...
mrhndsm's user avatar
-2 votes
1 answer
113 views

Batch script to re-size JPEGs in music folder to 350x350 and delete unwanted files

I currently use a script to rename music folders from eg. Taylor Swift - 1989 to a new folder Taylor Swift with a subfolder 1989 with all files moved into it. I've also added a rename line to change ...
Shane Cusack's user avatar
1 vote
2 answers
600 views

Passing a variable to a variable within a batch file

I'm grabbing a value from the registry assigning it to %%b and trying to pass %%b to another area within the batch file as shown below. But it comes out as %b. It does not pass the variable a second ...
GenShira's user avatar
0 votes
1 answer
198 views

How to Batch Apply Multiple Commands? FFmpeg

I have three commands that I've got to work individually for a set of videos, but cannot get them to apply together. I need to apply all three of these things to every video. 1) add audio, 2) speed up ...
Retsied's user avatar
0 votes
0 answers
26 views

Robocopy /MOVE, directory\tree not recreated, Win-11\Home

The line below previously worked with Win-10\Home; dir\tree remained intact. robocopy D:\ A:\Bak_Up /E /ZB /dcopy:dat /LOG:A:\Bak_Up.log /TEE By comparison, using Win-11\Home from the below .bat, ...
query-01's user avatar
1 vote
1 answer
542 views

Writing a batch script to copy files based on date

I have a folder on a local PC that updates files through Dropbox. I have created a batch script that runs through a scheduler each day. So far it checks to see if a folder is empty (C:\TheGlenFTP\...
ChrisH's user avatar
  • 11
-1 votes
1 answer
57 views

What is causing the xcopy file from having an error in it?

I am new to xcopy. I am trying to move a file that is in excel format to a new destination and as a csv file. I have to do this so that the DMExpress ETL job can move the file and then read it. This ...
Sevanna's user avatar
1 vote
1 answer
617 views

Batch file getting "The system cannot find the path specified"

I have been working on helping to resolve a batch file error per the title. It is attempting to run an .exe and output a file to a UNC, but keeps failing to find path specified. "C:\program files\...
Gabe's user avatar
  • 13
1 vote
2 answers
359 views

Exclude files with no extension - XCOPY or ROBOCOPY

I am trying to build a script that can copy folders, subfolders and contents from one drive to a backup drive. There are several files in each folder, subfolder. The condition I need to meet is that I ...
Hemil Mehul Shah's user avatar
2 votes
1 answer
522 views

create symlink to a batch file

I create a symlink to my .bat file (test.bat) mklink /D mycode test.bat The problem : the symlink won't be recognized as program that I can run : 'mycode' is not recognized as an internal or external ...
andio's user avatar
  • 293
1 vote
1 answer
599 views

Press any key to exit in command prompt?

I have an autohotkey script that runs cmd to check the hash for the selected file. I use certutil command for that task. #h:: hwnd := WinExist("A") for Window in ComObjCreate(&...
medukia's user avatar
  • 33
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 ...
Shane Cusack's user avatar
1 vote
1 answer
2k views

Disable Microsoft Edge Restore Pages Functionality

I scheduled a batch script with Task Scheduler to routinely close and reopen Edge to my website once a day while the browser is opened in Kiosk mode. I have: Taskkill /F /IM msedge.exe :: wait three ...
sushi's user avatar
  • 115
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: ...
Deutsch - Musik's user avatar
1 vote
1 answer
237 views

Windows Termin new tab and command

I'm trying to open a new tab in Windows terminal and execute a command after that. I've got this: wt -w 0 nt -d . cmd /k cd "D:\Minecraft\Waterfall Network\Waterfall Network - 01 - Proxy" &...
Deutsch - Musik's user avatar
0 votes
1 answer
176 views

Windows .Bat file behave differently when executed from command window and by double clicking on the bat file

batchfile is simple which has only two lines below, but behaves differently. run from command window. > sc \\server query | findstr SERVICE_NAME | find /c /v "" //result is 135 > ...
OfusJK's user avatar
  • 101
0 votes
1 answer
228 views

Opening a new instance of a OneNote notebook via Windows Batch Commands?

I'm attempting to use a batch file to open up a OneNote notebook .url shortcut, however, the notebook always ends up opening in the existing OneNote instance, replacing the existing view in the ...
S. Wow's user avatar
  • 1
0 votes
0 answers
206 views

Getting REG Hive List of an offline Device

I am trying to get an hive list files of an offline windows installation so I can backup the files in WINPE in my script. What I have tried reg load HKLM\Offline D:\Windows\System32\config\SYSTEM ...
OW2 Is Trash's user avatar
0 votes
1 answer
66 views

How to detect when a redirect operation of a windows cmd echo fails

Is there a way to detect if a echo redirection into a file, f.e. echo asdf > C:\nonexistingdirectory\asdf fails? ERRORLEVEL doesn't seem to be set. Is checking if the file exists afterwards the ...
ridilculous'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
3 votes
1 answer
1k views

Inexplicable “The system cannot find the drive specified.” How to solve it?

I'm creating a Batch file and it was working OK, then, suddenly, it started throwing an error that's making me scratch my head and reach the limit of my ignorance. I reduced the Batch file to the bare ...
Paulo Santos's user avatar
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 ...
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
3 votes
2 answers
3k views

Extract text between two strings from a file and save the output

How to extract the text between two strings from a file and save the output to another file, and invoke it in batch, at command line? To be more specific, let us say that the input file is SomeFile....
digital-Ink's user avatar
1 vote
1 answer
5k views

Open network folder in a .bat file

How do I open a network folder with a .bat file? explorer shell:NetworkPlacesFolder works like wonders in CMD but once I try to implement a path (e.g. \\104pc01-01\c$\), it simply doesnt work and I ...
Ben Murray's user avatar
1 vote
1 answer
173 views

What is the equivalent of Linux's && for windows

What is the equivalent of Linux's && for windows For example cd\ cd rcA powershell "ls | where {$_.Length -lt 100gb} | Remove-Item -Force -Recurse" What to add to make the script ...
God of Money's user avatar
-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 ...
Pacdizzle's user avatar
2 votes
2 answers
150 views

"if not exist \\ip\SharedDirectory\." in batch file creates delay

I would like to open a network drive in the explorer. The network drive is hosted on a PC, that is sometimes connected by WLAN and sometimes connected by LAN. Because of that, it has two different IPs....
SalamiMonster's user avatar
2 votes
1 answer
300 views

Run cwebp.exe in my batch file not working with space in file name

I create batch file in windows and add it in context menu to run script with right click menu. Batch file looks like: @echo off cwebp.exe -q 100 -m 6 -mt -af -progress -short %1 -o %~n1.webp Script ...
Rizwan.A's user avatar
0 votes
0 answers
84 views

How to replace -- More -- in more command (batch)

The more.com command in batch scripting is easy enough for people used to it. Space Display next page. Return Display next line. Q Quit. ... Etc... But to the inexperienced user this is not ...
Klinghust's user avatar
  • 793
1 vote
1 answer
218 views

Creating a .bat for screenshotting folders with ffmpeg

I was looking for a .bat script for ffmpeg and came across this thread on the forum here. The code in question is for %%F in (*.mp4) do ( If not Exist "%%~nF" MkDir "%%~nF" ffmpeg -...
Avery Mitchell's user avatar
0 votes
0 answers
37 views

Batch Move-Item operation only working on a fraction of the items [duplicate]

I am trying to move all directories which contain a file named '√.txt' to a separate directory, with the following line of code: Get-ChildItem -Path D:\music -Recurse -Filter √.txt | Select-Object -...
Michael Scoggins's user avatar
-1 votes
2 answers
2k views

copy files from server share to C:\Temp and then run the batch file that is copied locally

I need a login script to copy the contents of a directory from a file share to the local computer, and then run a bat file that gets copied locally as part of that process. if not exist "C:\Temp\&...
Paul's user avatar
  • 1
0 votes
2 answers
100 views

From a path, all files, including those stored in subfolders, but not the subfolder-structures themselves, only the files, are to be copied?

From path Y:\Server-MODS all files including those which are stored in subfolders, but not the subfolders themselves, but really only the files themselves are to be copied to the following path via ...
Peter Andres's user avatar
0 votes
1 answer
182 views

Batch rename in DOS

I have over 1000 files with the following format WMS_002248557A931EDE81AEE9DEF8AB0CCD.xml.20230607T141028.383-1443092915 WMS_0022485689451EDE81AEFD441B115F0C.xml.20230607T141430.753-1443334398 I want ...
user2635566's user avatar
1 vote
1 answer
89 views

Renaming multiple files in the command line

I have multiple files with names x_beta_5.txt x_beta_20.txt x_beta_300.txt and the list goes one how can the name of these files can be changed to x_5.txt x_20.txt x_300.txt I have tried using the ...
jarhead's user avatar
  • 113

1
2 3 4 5
25