Search found 4316 matches
- 15 May 2024 08:28
- Forum: DOS Batch Forum
- Topic: netsh Interface name store as variable
- Replies: 8
- Views: 11822
Re: netsh Interface name store as variable
Based on your initial netsh output you do not have any interfaces that are "Connected" and are "Ethernet" What output are expecting when nothing matches?
- 03 May 2024 16:36
- Forum: DOS Batch Forum
- Topic: Need help with misbehaving DOS code
- Replies: 2
- Views: 623
Re: Need help with misbehaving DOS code
Test if you have shifted out all the arguments before you goto the loop.
And the first two rules of debugging a batch file.
1) Do not run the batch file with your mouse. Open up a command prompt and run it from there.
2) Use ECHO ON at the top of your script.
Code: Select all
SHIFT
IF NOT "%~1"=="" GOTO loop
1) Do not run the batch file with your mouse. Open up a command prompt and run it from there.
2) Use ECHO ON at the top of your script.
- 08 Apr 2024 10:20
- Forum: DOS Batch Forum
- Topic: Success or failure echo
- Replies: 3
- Views: 611
Re: Success or failure echo
Robocopy has multiple return codes.
https://ss64.com/nt/robocopy-exit.html
https://ss64.com/nt/robocopy-exit.html
- 08 Apr 2024 07:32
- Forum: DOS Batch Forum
- Topic: DONT WORK: string input / if construct: output part of string with variable
- Replies: 1
- Views: 454
Re: DONT WORK: string input / if construct: output part of string with variable
Well you have delayed expansion enabled. It would help if you used it.
Code: Select all
if !string:~%counter%,1! EQU 1
- 06 Apr 2024 19:18
- Forum: DOS Batch Forum
- Topic: How to dynamically escape % symbols?
- Replies: 4
- Views: 756
Re: How to dynamically escape % symbols?
Jeb's MagicEcho might help
viewtopic.php?t=6446
viewtopic.php?t=6446
- 04 Apr 2024 08:46
- Forum: DOS Batch Forum
- Topic: how do i get the filesize from a filename? and compare with IF statement
- Replies: 2
- Views: 533
Re: how do i get the filesize from a filename? and compare with IF statement
Surprised your searching did not find any of these links. It is right on the main DosTips.com site library. https://www.dostips.com/?t=Snippets.FileSize As well as discussed in several threads. Here is one of them. https://www.dostips.com/forum/viewtopic.php?t=9274 No clue why you would assign the s...
- 31 Mar 2024 14:48
- Forum: DOS Batch Forum
- Topic: what is the difference between 1> and 2>
- Replies: 4
- Views: 787
- 15 Mar 2024 12:47
- Forum: DOS Batch Forum
- Topic: path to hosts file from script
- Replies: 3
- Views: 1089
Re: path to hosts file from script
%systemroot% is a variable which means you need double expansion.
Code: Select all
if "%%~a"=="DataBasePath" CALL set "hostspath=%%b"
- 05 Mar 2024 14:05
- Forum: DOS Batch Forum
- Topic: How to debug this bat file
- Replies: 6
- Views: 2964
Re: How to debug this bat file
Thank you for the reply... If I add ^ infront of the problematic characters (, ), | What would the line look like? I'm not familiar with that character. Isn't that line a remark? Why would the cmd interpreter care what characters are in a remark? Thank you, Are you saying you are not familiar with ...
- 29 Feb 2024 16:50
- Forum: DOS Batch Forum
- Topic: How to put path with blanks into "for" command? Masking & quotes
- Replies: 9
- Views: 6495
Re: How to put path with blanks into "for" command? Masking & quotes
We have a discussion about it here on DosTips. I will see if I can dig up that thread.mataha wrote: ↑29 Feb 2024 16:24Escaping the quotes shouldn't be necessary:
Code: Select all
for /f delims^= %%g in ('""D:\some\path\with blanks inside\myprog.exe" -p "......" %1"') do set "....."
- 28 Feb 2024 17:47
- Forum: DOS Batch Forum
- Topic: How to read a txt file to sort out the string then output to a folder with some txt files
- Replies: 9
- Views: 2671
Re: How to read a txt file to sort out the string then output to a folder with some txt files
OK I see now. I just had another issue when the fist line string has one space at the end. the folder will become 5 digits Schemes_to_Sign_for_829501 the folder will be 29501. Anyway to cut off the space before set it as folder? I bet if you use the sites search capability you will find all kinds o...
- 28 Feb 2024 13:34
- Forum: DOS Batch Forum
- Topic: How to compare 2 modified file timestamps?
- Replies: 6
- Views: 2377
Re: How to compare 2 modified file timestamps?
I should have known we answered this question before.
Compare timestamps of two files (seconds too)
Compare timestamps of two files (seconds too)
- 28 Feb 2024 13:21
- Forum: DOS Batch Forum
- Topic: How to put path with blanks into "for" command? Masking & quotes
- Replies: 9
- Views: 6495
Re: How to put path with blanks into "for" command? Masking & quotes
An extra set of escaped double quotes would have done the trick.
Code: Select all
for /F "Tokens=*" %%G in (' ^""D:\some\path\with blanks inside\myprog.exe" -p "......" %1^"') do set "....."
- 28 Feb 2024 13:12
- Forum: DOS Batch Forum
- Topic: How to compare 2 modified file timestamps?
- Replies: 6
- Views: 2377
Re: How to compare 2 modified file timestamps?
This will not get seconds. Only has minute precision.
Code: Select all
for %%G in ("aaaa.dat") do for /f "tokens=1-5 delims=/: " %%H IN ("%%~tG") do set "aaaats=%%J%%H%%I%%K%%L"
- 27 Feb 2024 13:44
- Forum: DOS Batch Forum
- Topic: How to read a txt file to sort out the string then output to a folder with some txt files
- Replies: 9
- Views: 2671
Re: How to read a txt file to sort out the string then output to a folder with some txt files
Thanks a lot! Antonio! Yes works perfefectly! Just a quick question for this line for /F "delims=\" %%a in ('findstr "_ ." source.txt') do ( So what is this 'findstr "_ ."? the rest I can understand.... Thanks again! Will You could help yourself by reading the help for the FINDSTR command. Use spac...