Questions tagged [batch]
Batch processing is the execution of a set of commands or software programs without user intervention. A batch file is a text file containing a sequence of such commands or programs invocations. Please use the tag [batch-file] for that.
3,972
questions
1
vote
1
answer
81
views
save multiple chkdsk logs to single file
I am creating a batch file to run chkdsk on every drive and log the output to a single file.
I am able to run a chkdsk and log it to a file with:
chkdsk a: > %userprofile%\desktop\test.log
...
2
votes
4
answers
2k
views
CTRL+C on a file/folder, how to get the filename in a batch? (read clipboard filenames from batch)
When you do Copy (CTRL+C) on a file or folder, then in some programs, but not all (example: it works in the Windows Explorer address bar, also with Everything indexing software), when doing Paste (...
1
vote
1
answer
5k
views
Equivalent of a wildcard in find for batch?
I'm almost certain this is a duplicate but I was unable to find it after a lot of searching so forgive me.
I'm looking for a way to have the equivalent of a wildcard in the find command. For ...
-1
votes
1
answer
387
views
Image copy with batch
i want to copy the images located in C:\Users\%USERNAME%\Pictures in a specific folder with batch, I try with this code but it don't work:
xcopy /s/e "C:\Users\%USERNAME%\Pictures\" ".\"%USERNAME%\...
1
vote
0
answers
34
views
local and remote configuration of a virtual com port
I am trying to reconfigure a known (virtual?) com port on multiple computers on a local network using a batch file.
A USB device we use is installed always as com9 and always comes in as 9600 baud ...
0
votes
2
answers
456
views
How to duplicate files onto an external backup drive, but first moving existing files to match the source folder tree and get a report?
If the title didn't make much sense then, let me provide more details.
My problem is that there are some identical files on both drives already, but they reside in different directories. Let me show ...
1
vote
1
answer
117
views
String Exist Check and Echo to File
guys. I was so immensely helped the last time I came here that I thought I'd come back for more, lol. Seriously, though. Those who helped in my last question have saved me hours of work in the last ...
2
votes
1
answer
104
views
Hiding windows shell from a program
I am running a batch file from vb.net, the problem is that everytime it runs a windows shell pops up and it is a bit annoying,how do fix this
2
votes
2
answers
4k
views
Unable to run batch starting Excel as scheduled task
I have the following Skript that was previously run manually:
set DIR="X:\SYSTEM\MAKROS"
X:
cd %DIR%
start /wait EXCEL.EXE /e-GENERATE_REPORTS BSYSTEM.XLA
When manually started, this works just fine....
0
votes
1
answer
76
views
How can I use Icalcs to grant access to a specific machine on the network?
In a Batch File I want to use Icacls to grant access to either all users (preferable) or a specific user on a remote machine. Currently, if I grant access to the user Joe, any machine on the network ...
0
votes
2
answers
612
views
Path with space error
I'm trying to fetch my java jdk path using a batch script.
Here is what i have so far:
@echo off
for /f %%j in ("java.exe") do (
set JAVA_HOME=%%~dp$PATH:j
)
if "%JAVA_HOME%".==. (
@echo ...
1
vote
0
answers
184
views
Windows batch script to check duplicates between an UNC path and local dir and delete them from the later
I want to delete all today's files in a local folder that already exist in a network path (UNC). I've run a batch including below commands but can't say it works properly.
@echo off
pushd \\server\...
1
vote
1
answer
3k
views
Script to check Computer Model and Download BIOS File
I've just started working with WindowsScripting and would like some help figuring out how to write a Script that would check the model of a Computer and store the result in Variable in the Bat file.
...
0
votes
1
answer
5k
views
Test if shared folder exists with timeout in a batch file
I've been using the following command to test if a shared network folder exists: if exist \\192.168.1.2\SharedFolder\ echo EXISTS however when it does not exist it takes around 15 seconds for it to ...
-1
votes
1
answer
2k
views
Copy file from Windows to Linux, when a shell script is executed
I have a program on Linux server, which runs a shell script on Linux server. Say /tmp/ShellScript.sh
Now I want to copy a file placed on my Windows Machine location C:\WindowsFolder\FileToCopy to ...
0
votes
1
answer
4k
views
Checking if a value name for a key is present on the windows registry through batch file
I need help for verifying if the value for a key exist or not.
I don't know how to check if my specified value name exist or not in my specified Key path.
I have this:
reg add "HKLM\SOFTWARE\....." ...
1
vote
1
answer
140
views
Batch code to run a file on Log On Windows 10 Home
Is there a batch file command I can use to run a file or command, not on boot but on Logon (like resume from sleep)?
0
votes
0
answers
483
views
Storing the value from a command into a variable in batch file
I would like to check if a java file exists on the PC and if it does, get the path of the file (excluding the filename) and use it in a variable. I need to do this using a batch file.
I have gotten ...
2
votes
2
answers
9k
views
Use Batch findstr for files with whitespaces
I'm trying to search for a string in a given file. This file can have whitespaces in its name and I'm having trouble with the Batch file.
I can easily do this by console getting the correct results:
...
1
vote
2
answers
2k
views
Set environment Path Windows 7
Trying to add stuff to the system environment Path via batch, vbs or anything really.
This used to work in a .bat, but has stopped:
setx -m path "C:\addtopath;%PATH%"
This used to work in VBS, but ...
1
vote
1
answer
1k
views
How to batch reverse resolve ip address with host command under linux?
I pick up ip addresses from the access log, I want to find out where those IP addresses come from. To do this I use this script:
cat /var/log/nginx/access.log |awk '{ print $1}'|sort| uniq -c |sort -...
1
vote
1
answer
950
views
how to hide a folder and everything inside it with batch files [closed]
how to hide a folder and everything inside it with batch files
I have researched for a long time and I cannot find anything. I need help on making a folder hide as well as everything else inside it ...
2
votes
2
answers
78k
views
How to get the ip address of a computer from its hostname? [duplicate]
I have the name of a computer on the network, and I need to know how to get the ip address of said computer from a batch file? Thanks.
0
votes
1
answer
869
views
My Batch script is not working On the Informatica Server ..But working on my Local machine
@echo off
setlocal enableextensions disabledelayedexpansion
echo print this line
set "firstLineReady="
(
for /F "eol=$ delims=" %%a in (DCRs_*.csv) DO (
if defined firstLineReady (echo()
...
4
votes
2
answers
11k
views
Force output to console in a batch script with output redirected to a file
I have a batch file that among other things sets up the environment and does a build. Both stdout (script output) and stderr (compiler errors) are redirected to separate files. Is it possible for a ...
-1
votes
1
answer
13k
views
Add Date-Time Stamp To Copied File using Windows Batch
I thought this would be simple but it seems more of a challenge than I thought.
I want a file to be copied and pasted with a time stamp appended. I get the time stamp using this code:
set hournum=%...
0
votes
1
answer
2k
views
Limit length of user input batch
I need either a native command or a lightweight simple 3rd party utility that I can use to set an environment variable in a batch file, but limit it to a certain number of characters.
For example:
...
2
votes
1
answer
2k
views
Can I unhide a single folder or file with batch script?
I want to make a script that can unhide a single given file or folder. This question covers how to switch between hiding or unhiding all files, but I want to know how to do the same for only one given ...
0
votes
0
answers
1k
views
How to select all SessionID in cmd (Wthout Administrator's SessionID)
I can show the active SessionID with the following command:
for /f "tokens=2-4" %a in ('"query session | find "Active""') do echo %b
While I can show disconnected SessionID changing the searched ...
3
votes
1
answer
1k
views
Need .bat that will make folder based on filename
I need .bat that will make folders based on filenames and put files inside. I have names formatted like this:
string1 - string2 - string3 - string2 - string3_number.jpg
I find out command that will ...
3
votes
1
answer
2k
views
How do I convert a batch of audio files on Windows?
I have a folder structure like this:
-dir1
-subdir1
-subdir2
-file1.wav
-file2.wav
-dir2
-etc...
Inside the folders are thousands of audio files that need to be converted....
1
vote
0
answers
642
views
How can I batch convert all of my video files to AAC audio without converting the video?
I've used XMedia Recode to do this and it works great. I set video to "copy", audio to "convert", and it takes 2 minutes for a 2GB file. There's two problems with it for batch work though. It doesn't ...
1
vote
2
answers
500
views
Unknown parameter in ren command in batch file
I am new to batch file programming and I am analyzing an existing batch file, which was implemented by a former developer in our company. So I am trying to figure out what he intended to do. I have ...
0
votes
1
answer
460
views
How to find and disable precedence policy that grays out "Log on as a batch job" policy
After a lot of digging, using rsop.msc, I have come to the conclusion, that the precedence policy PC - Windows 10 - OS - Global - (release v3.14) - CU prevents Log on as a batch job policy from being ...
0
votes
0
answers
205
views
How to run a batch or exe file when clicking to enter a drive or execute itself in windows
Although a batch file with executable commands could be run in different ways, I wonder if there is a way like making "autorun.Inf", which is disabled in windows,to run that "bat" or it's "exe" file ...
0
votes
1
answer
74
views
7-Zip: Automate script with excluding folder but include its content(set folder as root itself) in .cbr structure
When i use this script
for /d %%X in (*) do "c:\Programs\7-Zip\7z.exe" a "%%X.cbr" "%%X\"
in directory like this
mainfolder
comicfolder1
001.png
002.png
comicfolder2
001.png
002....
-1
votes
1
answer
48
views
Batch that lists files names in folder in txt file line by line [closed]
I need a batch file that will make list of files in directory of batch file, but must complete these requirements:
-List can't contain record of that .bat
-there will be hundreds to thousands files
-...
-1
votes
1
answer
2k
views
Sed does not exist for windows 10 64bits but?
I have the following unix script :
ZECOM = /path/to/command/dothis
for FILEg in *g.F
do
echo $FILEg
FILE=`echo $FILEg | sed 's/g\./\./' | sed 's/\.F/\.f/'`
$ZECOM -someoption -f ./optionsfile.sh $...
2
votes
3
answers
2k
views
Substring a variable with two percent in a .bat file
I faced a problem trying to implement a .bat file and I didn't find an answer.
I try to display all folder names without the system path.
I've tried something like that but it doesn't work.
@echo ...
0
votes
2
answers
2k
views
Deleting files using wildcards
I have hundreds of files named like SageAccts Company Name 2018-06-21 00-00-10.
The time and date are in the title. I wish to delete all files that do not have a date of 2018-**-05, 2018-**-15 or ...
0
votes
1
answer
3k
views
Extract text after space in batch?
I know how to extract text after a space in batch (see here How can I extract text before a character or string in a batch file?) however, this does not work with spaces. How would I extract the text ...
-2
votes
1
answer
2k
views
Code to remove line from batch file leaving empty line [closed]
The following code which I use: type C:\users\Public\Temp\%DB%.db | findstr /v /c:"%Remove%" >>newDB.txt works well in removing lines, however it leaves a line with a space instead of removing ...
0
votes
1
answer
588
views
Set /p giving invalid syntax error
I have the following function that works like this:
You input a string that resembles: text text=text like this: call :afterchar text text=text and it outputs with text=text on a line without creating ...
0
votes
0
answers
6k
views
Batch - Do something if filename contains string
I am trying to create a batch file to loop through all files in a directory, converting all files with no extension to a CSV.
I then want it to rename those files as they are given a default filename....
1
vote
0
answers
457
views
FFMPEG: Batch file to map multiple streams into single mp4
Been around this for hours without any luck.
I'm trying to convert the following command:
ffmpeg -hide_banner -i "%1" -i "%~n1_a0.aac" -i "%~n1_a1.aac" -i "%~n1_a2.aac" -map 1:0 -map 2:0 -map 3:0 -...
2
votes
1
answer
426
views
FFMPEG How to extract a variable number of audio streams?
I'm trying to make a small batch file that extracts all audio streams when dragging a video onto it.
ffmpeg.exe -i "%1" -map 0:a? -c:a copy "%1~extracted.aac"
But this seems to be overwriting the ...
1
vote
4
answers
30k
views
how to display local IP using a batch file?
So far I have the following in my batch file:
%comspec% /c ipconfig | find "IPv4" > %HOMEPATH%\desktop\MyIP.txt
%comspec% /c start notepad %HOMEPATH%\desktop\MyIP.txt
However, when I run the ...
1
vote
1
answer
5k
views
Trying to use a bat file but I get the error "7z is not recognized as an internal or external command, operable program or batch file
I assume I need to make Windows recognize 7z as something it can use but I don't know how.
I searched for answers and this one here said that I need to add the binary to my machine's PATH but I don'...
0
votes
0
answers
233
views
Move files and create folders script on windows?
Here's the situation: I have about 200k images on a folders (they're divided into thousands of subfolders). What i want to do:
Create a undefined amount of subfolders in another folder
move 500 ...
2
votes
1
answer
5k
views
Mkvmerge batch for change default audio
I want to change the default audio of my files but there are too many.
How can I do it with cmd or bat file?
This is my code for one file:
"C:/Program Files/MKVToolNix\mkvmerge.exe" --ui-language ...