Search found 4037 matches

by Squashman
03 Aug 2020 13:26
Forum: DOS Batch Forum
Topic: [SOLVED] Console output to text file missing entries.
Replies: 2
Views: 63

Re: Console output to text file missing entries.

The basic syntax to append STDOUT and STDERR to a file.
command >> file 2>&1
by Squashman
31 Jul 2020 10:16
Forum: DOS Batch Forum
Topic: help with loading an file!!
Replies: 4
Views: 97

Re: help with loading an file!!

So I will ask again. What is stopping you from reading package.txt instead of the batch file to get your result?
by Squashman
31 Jul 2020 08:40
Forum: DOS Batch Forum
Topic: help with loading an file!!
Replies: 4
Views: 97

Re: help with loading an file!!

So what is stopping you from reading package.txt instead of the batch file?
by Squashman
31 Jul 2020 08:30
Forum: DOS Batch Forum
Topic: JREPL: Cutting of a string after the n-th occurrence of specific character?
Replies: 17
Views: 570

Re: JREPL: Cutting of a string after the n-th occurrence of specific character?

vin97 wrote:
31 Jul 2020 05:45
I'm sorry, I thought I made it clear above but using DIR /B is not an option, since the ultimate goal is to scan for directories modified after a certain date.
DIR /TW
by Squashman
30 Jul 2020 18:24
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 467
Views: 355804

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

dbenham wrote:
30 Jul 2020 17:20
But right now I would rather invest my time on my music.
That "sounds" like the right decision. I spent more time on my bicycles this year. It was the only way to escape the quarantine insanity.
by Squashman
30 Jul 2020 18:22
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 15
Views: 306

Re: Only accept a numeric number.

I just looked back at my code in the script I am writing and I have used . . . if "%userinput%" gtr "2" . . .and it works there, very strange! I know why it works there, it is because I only input 0 or 1. Yes that is safe with single integers. H:\>if "12" gtr "2" echo yes H:\>if "2" gtr "12" echo y...
by Squashman
30 Jul 2020 17:07
Forum: DOS Batch Forum
Topic: Get line with highest numerical string
Replies: 12
Views: 2398

Re: Get line with highest numerical string

But I need to make the "pbcs" part more generic...It could be any non-numerical string here. THis seems to work with my test, but is it best practice based on my business need? for /F "delims=" %%a in ('findstr "outbox/logs/" test.txt ^|FINDSTR /R "[0-9].log"') The period means match a single chara...
by Squashman
30 Jul 2020 16:47
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 467
Views: 355804

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

dbenham wrote:
30 Jul 2020 16:22
Here is JREPL version 8.6
Still waiting for the infomercial to order JREPL for Dummies. Only $19.99. And if you order within the next 5 minutes we will waive the shipping and handling fee.
by Squashman
30 Jul 2020 16:43
Forum: DOS Batch Forum
Topic: Extract UNIQUE rows ONLY from .txt file.
Replies: 4
Views: 758

Re: Extract UNIQUE rows ONLY from .txt file.

OK, this actually works . . . ) else ( cls del "%Input_File%" type "%tmp%" | findstr /I /G:"%Filter%" >> "%Input_File%" del "%tmp%" echo. > "%Output_File%" & echo ERRORS FOUND . . . >> "%Output_File%" & echo. >> "%Output_File%" for /f "tokens=* delims= " %%a in (%Input_File%) do ( find "%%a" < "%Ou...
by Squashman
30 Jul 2020 16:35
Forum: DOS Batch Forum
Topic: Only accept a numeric number.
Replies: 15
Views: 306

Re: Only accept a numeric number.

You are comparing a string to an integer because you have the quotes. The quotes are included in the comparison. if "%userinput%" gtr 12 goto :Menu Just remove the quotes to compare the values as integers. if %userinput% gtr 12 goto :Menu Looking back at some of your previous code you did the compar...
by Squashman
29 Jul 2020 08:51
Forum: DOS Batch Forum
Topic: Memory leak when reading large text files
Replies: 17
Views: 349

Re: Memory leak when reading large text files

The FOR command reads the ENTIRE file into memory before it executes any of the DO block.
by Squashman
24 Jul 2020 19:17
Forum: DOS Batch Forum
Topic: Old topic about xcopy
Replies: 8
Views: 335

Re: Old topic about xcopy

You don't seem to showing us the correct information. Drive letters are normally mapped to at least a server share. So if my server share was \\casnprfil1\xxxx with a folder named folder like you are showing, the the drive mapping would look like Y:\folder Regardless you also have a variable within ...
by Squashman
16 Jul 2020 21:58
Forum: DOS Batch Forum
Topic: [SOLVED] Script closes when I press enter using set /p.
Replies: 2
Views: 305

Re: Script closes when I press enter using set /p.

By pressing enter, the variable is undefined. So when you are not using quotes the execution of the command becomes:

Code: Select all

if /i ==0  goto Exit_Program
That is invalid syntax.

The safe way to compare strings as you found out is to use quotes.
by Squashman
15 Jul 2020 09:16
Forum: DOS Batch Forum
Topic: loop without for to read lines of a file
Replies: 15
Views: 804

Re: loop without for to read lines of a file

Pretty sure I stole this from someone on this forum. Can't remember who.

Code: Select all

@echo off

call :Read <"file.txt"
pause
GOTO :EOF

:Read
set "line="
set /p "line="
if defined line (
  echo %line%
) else (
  GOTO :EOF
)
goto :Read
by Squashman
15 Jul 2020 08:04
Forum: DOS Batch Forum
Topic: Assign cmdline output to var with inner cmdline quotes?
Replies: 10
Views: 598

Re: Assign cmdline output to var with inner cmdline quotes?

Again: This does not help. When I code in the dos batch script: For /F "usebackq tokens=*" %%G in ('"D:\aaa\bbb cccc\ddd eee\myprog.exe" -parm1 "https://www.foobar.com/web/page/targetpage/q=$subparm" xxxx.jpg') Do Set "Var=%%G" I am getting an abort: "D:\aaa\bbb is not recognized as an internal or ...