50,319 questions
Score of -4
0 answers
39 views
What are the mostly used ways to access the output/result from a Windows command that can be done within a batch file? [duplicate]
I started learning batch programming last week. Below are the 3 files I was testing with:
main.cmd:
fc /b aa.txt bb.txt
aa.txt:
This is the aa text file
bb.txt:
This is the bb text file
I ran main....
Score of 1
2 answers
88 views
How can I use error suppression or output redirection to prevent the set command from emitting its message for non-existing variables?
In Windows 11 pro, I'm writing a cmd.exe batch script subroutine to clear variables who's names start with names passed to the subroutine as follows:
Here is how the subroutine is called and its ...
Score of -6
0 answers
70 views
Why is this cmd.exe batch if-statement erroring? [duplicate]
I'm running Windows 11 and when I run the following batch file, after I press the enter key, it displays in the command line console:
100 was unexpected at this time.
\>if /A 100 LSS 10 echo "...
Score of -1
2 answers
108 views
How to convert batch file parameters to JSON?
I have a .bat script called with a few parameters, the last one -plusthis (optional, but must be the last one) is followed by key-value pairs enclosed within double-quotes, with an equal sign between ...
Score of 0
0 answers
91 views
Windows Batch If Directory Exists running both conditions
I am writing a script that is meant to be ran at the end of an application being installed. The script needs to check if certain folders in C:\ProgramData already exist, create new ones if they don't ...
Advice
0
votes
5
replies
82
views
Trying To Find A batch file
I'm trying to find a batch file that can run 7zips unzip command on all the .zip archives in a folder and all of its subfolders while keeping the structure of said folders and subfolders. for example
...
Advice
0
votes
11
replies
149
views
How can I tell if a command is available in real DOS?
I want to create a batch program that allows me to execute a command, but only if the command is available in MS-DOS 6.22.
The command is accessible as long as it is located in any path included in ...
Advice
0
votes
1
replies
94
views
How to make a batch file make a .txt file unless the file is already made where it will just edit it
Please can someone help me in my batch file that I am making. It is running on start-up already, however I would like it to make a .txt file or if the .txt file is already in that directory, edit it ...
Advice
1
vote
2
replies
115
views
How to bypass the 8-digit mark?
I have a directory with about 15,000 files (images, movies. sounds, etc.), "Dir1".
I also have a file with about 2,000 files that I need to find in "Dir1" and transfer to "...
Advice
0
votes
1
replies
86
views
Creating a batch script to automate zipped MP3 renaming?
I'm attempting to make a batch script/file to automate the following process:
Unzip .zip file with MP3 files in it
Rename Mp3s based on track listing (i.e. "XYZ (1)" becomes "01 XYZ (...
Score of 1
1 answer
133 views
Extracting File Name from Path in Batch File
I am trying to make a batch program that cycles through files in a directory. My code is nested in a loop like so:
for /r "path/to/dir" %%f in (*.json) do (...)
%%f is a full path, but I ...
Advice
0
votes
2
replies
69
views
Learning Batch to automate basic steps in Windows 11
What would y'all say is the fasted way to learn and use batch?
I've started with a few basic scripts to automatically open a few programs on startup,
Additionally a generic matrix scrolling text thing ...
Best practices
0
votes
2
replies
127
views
For use by ServerFault scripters at shell - any OS "default top" names
What is the right list of characters for default, top at sorts of operating system as prefix?
AAAA
1111
Variation or different. As in DOS, a structure for files and operations at "most important ...
Score of 1
1 answer
220 views
wmic os get localdatetime suddenly failing
Intro
I have the a BAT file I am executing through cronical ( a windows cron like service).
Everything was working fine for 10 days..and then today suddenly the timestamp calculation is failing, and ...
Advice
0
votes
1
replies
60
views
fc /b giving different results when using in a loop
I have a batch script compare.bat where I compare a 2 files using fc.
In my Example AA is different and BB and CC are identical.
When I use fc as in the top example Ex1 it preoduces " Files are ...