Search found 197 matches

by Sponge Belly
03 Feb 2013 17:28
Forum: DOS Batch Forum
Topic: Generate nearly any character, including TAB, from batch
Replies: 15
Views: 25884

Re: Generate nearly any character, including TAB, from batch

Hello All! Good news for those who don't have forfiles on their systems: MVP Daniel Petri wrote an article on the Windows 2000 Resource Kit that contains download links to many of the tools in said kit, including forfiles. But the link is to an early release that doesn't do the hex escapes. Fortunat...
by Sponge Belly
15 Jan 2013 17:58
Forum: DOS Batch Forum
Topic: Output text without linefeed, even with leading space or =
Replies: 13
Views: 10717

Re: Output text without linefeed, even with trailing space o

Oops! I checked and find can output Unicode and findstr can't. But find is no good either because it appends CR+LF to output. Sorry about that... Can type work with Unicode files from a cmd /u subshell? I seem to recall some discussion about this before, but of course I can't remember when or where....
by Sponge Belly
15 Jan 2013 16:54
Forum: DOS Batch Forum
Topic: Output text without linefeed, even with leading space or =
Replies: 13
Views: 10717

Re: Output text without linefeed, even with trailing space o

Hi Jeb and welcome back. Brilliant workaround for the "echo without linefeed" problem. Wish I'd thought of it! I had thought of using copy /a, but I didn't know how to get rid of the CtrlZ at eof. Never occurred to me to combine it with the /b switch for the destination file. One tiny sugg...
by Sponge Belly
23 Dec 2012 15:33
Forum: DOS Batch Forum
Topic: store nth line of file in variable
Replies: 8
Views: 4168

Re: store nth line of file in variable

Hi Again! I've written a program to copy a line from a text file and save it to a new file. It uses more, findstr, and temporary files to do the heavy lifting so it should work for lines >8191 characters. I won't include the program here because much of the code is similar to my previous effort. But...
by Sponge Belly
12 Dec 2012 14:50
Forum: DOS Batch Forum
Topic: Quotes, Parens, and GOTOs in Delayed Expansion
Replies: 1
Views: 1009

Quotes, Parens, and GOTOs in Delayed Expansion

Hello All! I have the following block of code in my win2unix program: setlocal enabledelayedexpansion if "%~1"=="" (if /i "!cmdcmdline!"=="!cmdcmdline:%~n0=!" ( endlocal & goto usage)) else ( if /i "!cmdcmdline!" neq "!cmdcmdline:%~n0=!"...
by Sponge Belly
03 Dec 2012 15:00
Forum: DOS Batch Forum
Topic: bowling, anyone?
Replies: 7
Views: 3976

bowling, anyone?

Hi Everyone! Since Christmas is a time for nostalgia, I thought I'd remind you about Elf Bowling. It was first released by NVision Design back in November, 1999. It instantly went viral and many sequels followed. But the original is surprisingly difficult to get hold of... until now! There's a link ...
by Sponge Belly
24 Nov 2012 15:54
Forum: DOS Batch Forum
Topic: Another take on safe string replace
Replies: 19
Views: 5465

Re: Another take on safe string replace

Hi Carlos! I have learnt the hard way not to bother Liviu until he's had his morning coffee See Jeb's answer in this SO thread for an example of safe string return. And once you've absorbed that , you can try bending your mind around Dave Benham's Macros with Arguments . Dave says you can wrap any f...
by Sponge Belly
23 Nov 2012 15:36
Forum: DOS Batch Forum
Topic: Batch findstr with quotes
Replies: 5
Views: 2620

Re: Batch findstr with quotes

Hi Raam! Welcome to DosTips. Maybe something like this might help... findstr /bl ^"\"%~1\"^" Remember that the dot (.) in the IP address is a findstr metacharacter and should either be escaped with a backslash (\) or turned off with findstr's /l (literal) switch. Also, I'm guessi...
by Sponge Belly
23 Nov 2012 14:45
Forum: DOS Batch Forum
Topic: store nth line of file in variable
Replies: 8
Views: 4168

Re: store nth line of file in variable

Thanks Ed!

That's what I thought.

Will file that link away for future reference.

Btw, who broke the bad news about more's 64k line limit? Does anyone have a link for that? I like to cite references in my blog posts whenever practicable.
by Sponge Belly
23 Nov 2012 14:16
Forum: DOS Batch Forum
Topic: store nth line of file in variable
Replies: 8
Views: 4168

Re: store nth line of file in variable

@Ed and @Mic: Well, I suppose if we had bigfile.txt and we wanted to isolate the 100th line in its own file, we could try the following from the command line: more +99 bigfile.txt | findstr /n $ | findstr /b "1:" ^ | (pause>nul&pause>nul&findstr $ >line100.txt) Should work with lon...
by Sponge Belly
23 Nov 2012 06:18
Forum: DOS Batch Forum
Topic: store nth line of file in variable
Replies: 8
Views: 4168

store nth line of file in variable

Hello All! A little program that accepts a line number, a filename, and an optional variable name from the command line and stores the contents of the line from the file in the variable (uses NTHLINE if none specified). @echo off & setlocal enableextensions set "a2z=abcdefghijklmnopqrstuvwx...
by Sponge Belly
23 Nov 2012 04:43
Forum: DOS Batch Forum
Topic: Another take on safe string replace
Replies: 19
Views: 5465

Re: Another take on safe string replace

Thanks for enlightening me, Liviu!

And apologies for saying your code would choke on control characters. I don't know why I thought that. Maybe if I read first and typed later...
by Sponge Belly
23 Nov 2012 04:17
Forum: DOS Batch Forum
Topic: Windows Narrator.bat (Read from file)
Replies: 7
Views: 3171

Re: Windows Narrator.bat (Read from file)

Hi Boombox! Have you tried Best Free Windows Narrator Voices ? Some good links there. There are also rumours that ETI Eloquence voices can be made to work with NVDA (an open source screen reader for Windows), but it's legally murky and I couldn't possibly comment further... On a lighter note, you mi...
by Sponge Belly
22 Oct 2012 08:46
Forum: DOS Batch Forum
Topic: update to win2unix
Replies: 8
Views: 3537

update to win2unix

Hello All! Everyone knows this old trick of converting Unix text files to Windows format: more unix.txt > win.txt Btw, more waits for keypress after scrolling 65,534 lines no matter what. But going the other way (from Windows to Unix) is less straightforward. But with a little chicanery and a lot of...