All Questions
Tagged with .bat or batch-file
50,337 questions
Advice
0
votes
2
replies
54
views
Get cmd file for copying Files
i need to make cmd file that copying "Merge.txt" from the same path directory of cmd file to "D:\StackFlow\"
Note: i want to copy that file whenever i changed the directory source
Advice
0
votes
4
replies
63
views
How to separate variables on each line in a batch SET statement?
I have some data fields gathered in a SET statement like this:
set "datastr=%num_cde%, %id_achat%, %modele%, %sysfam%, %serial%, %ldt%"
later echoed as an email body as:
SET "EmailBody=...
0
votes
0
answers
48
views
Windows batch variable substitution fails when variable is empty
When testing for a particular letter in a batch file option, I use code like:
set opts=%2
if not "%opts:t=%" == "%opts%" goto :handle-t-option
However, if %2 is empty, which means ...
1
vote
1
answer
105
views
Escaping % from nested Batch scripts inside a loop
I have a batch escaping problem involving 3 files:
chain.bat conatins this code:
for %%x in (%*) do (
%%~x
)
b.bat contains this code:
chcp 65001 >nul
start chrome --profile-directory="...
-1
votes
0
answers
80
views
How to run a bat file from taskscheduleR R package
I am trying to run a bat file using the taskscheduler_create function from the taskscheduler R package without being sucessful. I can run the R script without problems but it crashes with a bat file. ...
-1
votes
1
answer
67
views
Saving matplotlib figures when running multiple subsequent python files via a .bat file on Windows
SET UP
I have multiple scripts that I execute with a .bat file, like so:
cd C:\\path\\to\\my\\project\\directory
echo Running script 1
"C:\\ProgramData\\miniforge3\\envs\\myenv\\python.exe" ...
11
votes
2
answers
747
views
Retain the exact modification timestamp of a file in a Git repository
I'm trying to persist the last modification timestamp of a set of files in a Git repository. I understand that Git doesn't natively support tracking filesystem metadata, so some sort of customization ...
Advice
0
votes
3
replies
106
views
CSV file editing via a bat file
I have a report CSV file that has some special characters in the header row. I would like to set up a short script in a .bat file to remove these characters, so I can schedule a task to automatically ...
0
votes
3
answers
127
views
batch renaming of numeric files
I would like to rename a bunch of files in a given directory that are already present in ascending order to another line of consecutive ascending numbers. The goal is to close gaps in between and get ...
Best practices
1
vote
4
replies
131
views
Fastest way to count lines in a .csv from a .bat file?
I have this .bat file that I use to open .csv files, which counts the lines in them and uses Excel to open if under a million records and a separate program to open if more than a million records. The ...
-2
votes
1
answer
73
views
DO Error during String Replacement using Windows Batch Script
I obtained a batch script from Google AI for performing string replacement on the content of a list of text files in Windows. This is what I got--with a little tweaking, first. (Just testing at this ...
1
vote
4
answers
174
views
How to get from a url string the path to a file with a FOR loop in a Windows batch file?
Given is a string which is a url of a file, e.g. http://url.com/file.zip. I want to extract the path without the file name, i.e. http://url.com/.
My idea for doing this was to break down the string ...
1
vote
3
answers
250
views
How to convert a batch to Powershell parallel processing to run over thousands of input files?
I have a large number of files (about 3800) that I want to run a program over. The program reads a WAV file and makes a short .TSV text file containing the WAV's lip-sync data (but that is by-the-by ...
-1
votes
2
answers
103
views
Passing variable with leading zero to BAT file causes error [closed]
My bat file named A.BAT is:
@echo off
set /a file = %1
set /a group = %2
@echo file is %file%
@echo group is %group%
ren %file% myfile-%group%_%date%.dat
exit
=============...
1
vote
1
answer
105
views
Windows batch file cuts off file extension in for statement
I noticed that some software I use, AutoDarkMode, doesn't randomize the first wallpaper it switches to, so I thought I'd write a batch file to do it by copying one wallpaper in the folder and renaming ...