Search found 4314 matches

by Squashman
08 Apr 2024 10:20
Forum: DOS Batch Forum
Topic: Success or failure echo
Replies: 3
Views: 150

Re: Success or failure echo

Robocopy has multiple return codes.
https://ss64.com/nt/robocopy-exit.html
by Squashman
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: 71

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
by Squashman
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: 123

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...
by Squashman
15 Mar 2024 12:47
Forum: DOS Batch Forum
Topic: path to hosts file from script
Replies: 3
Views: 393

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"
by Squashman
05 Mar 2024 14:05
Forum: DOS Batch Forum
Topic: How to debug this bat file
Replies: 6
Views: 1050

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 ...
by Squashman
29 Feb 2024 16:50
Forum: DOS Batch Forum
Topic: How to put path with blanks into "for" command? Masking & quotes
Replies: 9
Views: 5313

Re: How to put path with blanks into "for" command? Masking & quotes

mataha wrote:
29 Feb 2024 16:24
Escaping 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 "....."
We have a discussion about it here on DosTips. I will see if I can dig up that thread.
by Squashman
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: 1439

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...
by Squashman
28 Feb 2024 13:34
Forum: DOS Batch Forum
Topic: How to compare 2 modified file timestamps?
Replies: 6
Views: 938

Re: How to compare 2 modified file timestamps?

I should have known we answered this question before.
Compare timestamps of two files (seconds too)
by Squashman
28 Feb 2024 13:21
Forum: DOS Batch Forum
Topic: How to put path with blanks into "for" command? Masking & quotes
Replies: 9
Views: 5313

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 "....."
by Squashman
28 Feb 2024 13:12
Forum: DOS Batch Forum
Topic: How to compare 2 modified file timestamps?
Replies: 6
Views: 938

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"
by Squashman
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: 1439

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...
by Squashman
26 Feb 2024 11:06
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: 1439

Re: How to read a txt file to sort out the string then output to a txt file

It will create a folder name as 852046 under this folder there will be some files, in this cases, will be three files, one is T503-08667-0108.txt, T503-08667-0109.txt, and T503-08939-0102.txt This is contradictory. You are asking to create a folder but then you go on to say that several files alrea...
by Squashman
26 Feb 2024 11:03
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: 1439

Re: How to read a txt file to sort out the string then output to a txt file

Why haven't you attempted to do this task yourself?
You have certainly been given enough code examples over the past 7 years to accomplish this task.