Search found 4309 matches

by Squashman
15 Mar 2024 12:47
Forum: DOS Batch Forum
Topic: path to hosts file from script
Replies: 3
Views: 154

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: 517

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: 4928

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: 772

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: 5
Views: 573

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: 4928

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: 5
Views: 573

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: 772

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: 772

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: 772

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.
by Squashman
25 Feb 2024 14:37
Forum: DOS Batch Forum
Topic: Automating the generation of macros usable within other macros
Replies: 4
Views: 707

Re: Automating the generation of macros usable within other macros

Maybe we could ask Peter to put some of this on the main web page of the site. Or maybe we start a git repo.
by Squashman
22 Feb 2024 13:51
Forum: DOS Batch Forum
Topic: How to get the next reboot time of Windows 10
Replies: 1
Views: 565

Re: How to get the next reboot time of Windows 10

How would we know what program or scheduler is doing a programmatic reboot?
by Squashman
18 Feb 2024 09:00
Forum: DOS Batch Forum
Topic: Move flashing prompt sign away from left edge of PowerShell window
Replies: 7
Views: 14013

Re: Move flashing prompt sign away from left edge of PowerShell window

Seems to work just fine for me. Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\Squashman> function prompt {Write-Host (" " * 10) -NoNewline} PS>function prompt {Write-Host (" " * 15) -NoNewline} P>...
by Squashman
02 Feb 2024 11:11
Forum: DOS Batch Forum
Topic: Extract missing record
Replies: 6
Views: 2516

Re: Extract missing record

Thank you Antonio, it works fine, but the problem is a pdf directory is a windows share slow and takes long time to read 1 milion of pdf, so I prefer before do a dir /b > file.txt and work on a file.txt As I said in my previous post, a base FOR command should be faster than reading a million line f...
by Squashman
01 Feb 2024 17:13
Forum: DOS Batch Forum
Topic: Extract missing record
Replies: 6
Views: 2516

Re: Extract missing record

yes you are right, the problem is that with millions of records it takes too long, so I decided to do a dir of the directory first. I'll try to work on it and post the solution, see if I can solve the problem With that big of a file you are going to see slow processing with the FOR /F command readi...