Search found 3995 matches

by Squashman
02 Jan 2012 01:37
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 18066

Determining the number of lines in a file.

Background: I work with Fixed fielded Fixed Length text files. This basically means every single line in the text file is the same length. Each field in the line has a predefined starting and ending positions. Name 1-30 Street 31-60 City 61-80 etc.... Most of the files I work with have a record len...
by Squashman
01 Jan 2012 18:51
Forum: DOS Batch Forum
Topic: Drag & Drop Batch files
Replies: 4
Views: 2999

Re: Drag & Drop Batch files

On Windows 7 were you testing on 32 or 64 bit? I swear I had tested on 32bit and it bombed at 4096 bytes of input. Maybe I didn't test very well. It is good to know that Windows 7 allows more input.
by Squashman
01 Jan 2012 01:10
Forum: DOS Batch Forum
Topic: how to timeout on xp
Replies: 3
Views: 3896

Re: how to timeout on xp

Two options.

Download the Windows 2003 server resource kit and use the sleep command in there.

Use the PING trick.
http://www.xinotes.org/notes/note/992/
by Squashman
30 Dec 2011 12:17
Forum: DOS Batch Forum
Topic: How to search and replace a string
Replies: 13
Views: 4236

Re: How to search and replace a string

Well, don't enclose the options in quotes but escape all possible separators (spaces, commas, equal signs, the quotation mark etc.) instead. for /f tokens^=1^,2*^ delims^=^"^ %a in ("%tmp1%") do echo a is %a &echo b is %b Note: there are 2 spaces between the last caret and the %a...
by Squashman
30 Dec 2011 11:18
Forum: DOS Batch Forum
Topic: Drag & Drop Batch files
Replies: 4
Views: 2999

Drag & Drop Batch files

Just some friendly discussion on the input length restriction of 2048 bytes for drag and drop onto a batch file. I had mentioned it to aGerman in some private messages and he suggested we start a thread about it. I use drag & drop to process specific files in a directory. It also makes it easier...
by Squashman
30 Dec 2011 09:04
Forum: DOS Batch Forum
Topic: How to disable network bridged connections with batch.
Replies: 2
Views: 1553

Re: How to disable network bridged connections with batch.

Doesn't seem to be supported by the NETSH command.

Code: Select all

C:\Users\Squash>netsh bridge uninstall /?

Usage: uninstall
       Not supported.
       Please go to the Network Connections folder to uninstall.
by Squashman
30 Dec 2011 08:50
Forum: DOS Batch Forum
Topic: multiple file type search
Replies: 9
Views: 3025

Re: multiple file type search

I save this batch file in c:\, after that I run the batch, it says can't perform a cycle copy, 0 files copied Of course that is going to happen if you execute it from the root of the drive. You said earlier that you wanted to copy to the D: drive though. If you were copying to a separate drive then...
by Squashman
30 Dec 2011 08:40
Forum: DOS Batch Forum
Topic: batch to automatically ping IPs
Replies: 3
Views: 2733

Re: batch to automatically ping IPs

Just wondering why you are using one batch file to call another batch file when this could all easily be done in one batch file?
by Squashman
28 Dec 2011 10:44
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 32
Views: 24433

Re: infinite loop with break condition

I was reading this over at stack overflow again. m Would this work for you. @echo off & setlocal EnableDelayedExpansion if "%1"=="loop" ( set /a num=0 for /l %%f in (1 0 10) do ( set /a num+=1 IF "!num!"=="500" echo.>%%f.tmp if exist %%f.tmp exit ) goto :e...
by Squashman
28 Dec 2011 08:48
Forum: DOS Batch Forum
Topic: infinite loop with break condition
Replies: 32
Views: 24433

Re: infinite loop with break condition

Was reading something over at Stack Overflow. This creates your infinite loop with a break but is also kills your batch file. Which would also be pointless. @echo off & setlocal EnableDelayedExpansion set /a num=0 for /L %%N in (1 0 10) do ( set /a num+=1 CALL :loop !num! ) :__loop () :loop IF &...
by Squashman
27 Dec 2011 12:31
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6653

Re: delete 2 days older folders

Posting a link to a script written on another forum by an old buddy of mine (TheOutcaste). m This script should work for you and it doesn't rely on what your DATE variable is. Credit is given throughout the script from whom wrote the original code. I can show you what lines you need to change for yo...
by Squashman
27 Dec 2011 11:57
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6653

Re: delete 2 days older folders

And squashman, that is what my script also doing, it is also keeping the two latest folders. But i want to keep other folders also which are not of month-date format. Regards, My script does not touch your XYZ or ABC folders. I pipe the output of the DIR command to the FINDSTR command. The findstr ...
by Squashman
27 Dec 2011 11:23
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6653

Re: delete 2 days older folders

And squashman, that is what my script also doing, it is also keeping the two latest folders. But i want to keep other folders also which are not of month-date format. Regards, My script does not touch your XYZ or ABC folders. I pipe the output of the DIR command to the FINDSTR command. The findstr ...
by Squashman
27 Dec 2011 06:48
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6653

Re: delete 2 days older folders

I should note that technically my script does not delete folders older than two days, it just keeps the two newest folders that match your date pattern. If you create a new folder every day for some type of backup this will essentially keep the two newest folders.
by Squashman
27 Dec 2011 06:37
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 6653

Re: delete 2 days older folders

A batch file using the ForFiles command in combination with the findstr command may work better but ForFiles is not native to Windows XP. Going to throw my idea out there but I am sure other suggestions may come along that will work better as my script may have some caveats because I don't know how ...