All Questions
29
questions
0
votes
0
answers
22
views
“psloglist” for system event returns an error: -1073740940
My batch must extract system and application events.
I use two psloglist (vers. 2.82) cmd one after the other.
psloglist \\Home -d 7 -f we sys > system.log
psloglist \\Home -d 7 -f we app > ...
1
vote
1
answer
557
views
DOS batch file to display netsh channel output
I'm trying to get wifi Channel output from netsh command to be 2.4GHz or 5GHz
The following provides me with Channel output:
netsh wlan show interface name=Wi-Fi | findstr "Channel"
Output ...
1
vote
1
answer
175
views
How to discover the page code to show a specific character in MSDOS/Batch?
I made a batch-file snake game and inserted some special characters via HEX to ANSI conversion in Notepad++.
It worked normally. But I noticed that there was an update to the Consolas font and two of ...
1
vote
2
answers
2k
views
Why is change directory not working when SETLOCAL ENABLEDELAYEDEXPANSION is used
I have an existing windows batch script (named as test1.bat) as below :
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set nop=4
for /l %%z in (1, 1, %nop%) do (
set x=%%z
echo !x!
)
chdir /d D:\app\
...
1
vote
1
answer
766
views
How do I download the RSS Feed XML file in dos command batch mode?
I have a specific requirement that I need to download the RSS feed file (it is in XML format) from the given link using dos command.
I have tried the following command and it keeps giving me syntax ...
1
vote
2
answers
1k
views
How to read files name last character and and rename them by running a batch file
I have 3 files in a folder which are:
XXX_a.txt
XXX_b.txt
XXX_c.txt
The filename can be varied, only the last character of the 3 files
a, b and c are not changed
I need to rename the files as below:
...
3
votes
2
answers
1k
views
batch file put if inside for loop error
I have a working for loop to print all zip file's name under one working directory:
@echo off
setlocal
for %%i in (*.zip) do (
echo %%i
)
I have another working if block to check and print ...
1
vote
2
answers
2k
views
Running file from batch file
I am working in Windows 10.
This is my code saved in .bat file:
%windir%\System32\cmd.exe "/K" C:\Users\Alex\AppData\Local\Continuum\anaconda3\Scripts\activate.bat C:\Users\Alex\AppData\Local\...
0
votes
1
answer
2k
views
How to start Notepad++ from a Windows 10 batch file?
When I Google this, I get pages about running Notepad++ from the command line, running batch files from Notepad++, and pages that start by explaining how I set my path variable.
I am not allowed to ...
0
votes
1
answer
840
views
How can I check if a file starting with a letter is in the folder?
Why does this script always return "A" even when there are no files starting with A in the folder, but there being files starting with B and C?
@ECHO OFF
if exist %cd%\a* goto A
if exist %cd%\b* ...
0
votes
1
answer
38
views
Writing out to a file based off of the output of the command
I have seen many examples of how to create a file through command line using a static name but I need to get it to show a dynamic name based off of my commands output. What I mean by this is the ...
2
votes
1
answer
4k
views
Log date and time accurately with batch file
I have a batch file that backups my files and works nicely, however I wanted to be able to log the exact time each task starts, but it is not working as I expected.
@echo off
> C:\log\%date:~3,2%-%...
0
votes
1
answer
261
views
*NIX getopt alike for DOS
I want to write a DOS script with multiple optional option flags. I have to parse these optional options.
An example:
get_resolution.bat /?
get_resolution.bat /h input.jpg
get_resoltion.bat /v ...
3
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 ...
1
vote
0
answers
358
views
Create variable from file text in MS-DOS 6.22 batch file
This doesn't work, for example:
set var=<text.txt
It can be done like this in BASH:
#!/bin/bash
variable=$(cat text.txt)
echo $variable
1
vote
1
answer
361
views
Loop n-times on DOS 6.22
FOR /L %%parameter IN (start,step,end) DO command does not work on DOS 6.22.
The /L argument to loop through a set of numbers is not available in DOS 6.22.
FOR in DOS 6.22 can merely loop through a ...
-1
votes
1
answer
2k
views
Batch script to merge files using copy command in numerical order
Would appreciate it if anyone can help me with this request.
I need a dynamic batch script which can do the below command for ANY number of files:
Copy 1.txt + 2.txt + 3.txt + 4.txt newfile.txt
If ...
0
votes
1
answer
794
views
Appending an extension to a new file created with xcopy
I've been having problems with xcopy in the past few days, and I'd like to stop ripping out my hair. In my DOS class, a portion of an assignment requires a file to be copied (with xcopy), and the new ...
0
votes
1
answer
430
views
Is it possible to filter attribute of dos command output?
Below is output of this command netsh interface ipv4 show interface
Idx Met MTU &...
0
votes
1
answer
884
views
run all batch scripts in all subdirectories
I want to run all x.bat automatically in all recursive sub directories:
C:\test
|
+---folder1
| x.bat
|
+---folder2
| x.bat
|
+---folder3
. x.bat
.
.----foldern
...
0
votes
1
answer
43
views
Check if an user has given as an input 1 or more then 1 in an batch file
I am having an question with an Batch file
Is it possible to let an user choose how many files it will enter?
For example
set /p count=Enter the number of files you are willing to set:
IF %count% ==...
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
3
answers
199
views
Variable Assignment for arguments with a for loop [closed]
Alright, so, I've searched quite a bit on how to do this but I've given up as I simply couldn't find anything.
So, I have a code (below); it's main purpose is to get 9 arguments and assign them as a ...
0
votes
1
answer
268
views
Find the character in line?
I am trying to find the some character in file using find or findstr, for example file contents like:
"/test/abctest/abci.txt = c:\abctest\tst\work\workt.txt;abc_test1"
"/test/abctest/abci.txt = ...
0
votes
2
answers
16k
views
Windows command to perform a similar function to spool command in SQL or Script command in UNIX?
In DOS is there a command to perform a similar spool function in SQL or Script command in UNIX to create a log?
I want to print all command line output to a file but I don't want to use the echo ...
5
votes
2
answers
10k
views
taskkill - end tasks with window titles ending with a specific string
I need to write a batch program to end all MS office communicator tasks with window titles (usually ending with pattern "- Conversation" .
I tried
taskkill /FI "WINDOWTITLE eq *Conversation" /IM ...
1
vote
2
answers
4k
views
Run SOX batch on files in a relative folder
I have a windows batch script that runs a SOX command on various files, but I don't know how to get the batch to run on files in a relative path to that of the SOX executable. Currently all the files ...
3
votes
6
answers
28k
views
How to list all files on all hard drives with output in MS-DOS batch?
How can I list all files (including system and hidden) on all hard drives (not removable drives)?
I think in something like a:
dir -a -h *.* /s > file.txt
but this is for the specific drive ...
5
votes
2
answers
46k
views
How to input automatically in BATch file on DOS?
I want to run a command that prompt for an argument, can I do a BATch file that run this command and then wait for a sec and "write" or "type" automatically (like a live person) the argument? Thanks.