Search found 177 matches
- 05 Jul 2015 23:27
- Forum: DOS Batch Forum
- Topic: Add number List in For Loop without enabledelayedexpansion
- Replies: 15
- Views: 11270
Re: Add number List in For Loop without enabledelayedexpansi
aGerman, your example uses line numbers generated by FINDSTR. My requirement is to add sequential numbers only to the lines FINDSTR returns, which are a subset of a large text file. The way I found to right-align a column of numbers to 5 places in the working batch file that I posted was to create w...
- 05 Jul 2015 15:37
- Forum: DOS Batch Forum
- Topic: Add number List in For Loop without enabledelayedexpansion
- Replies: 15
- Views: 11270
Re: Add number List in For Loop without enabledelayedexpansi
aGerman, thanks for your thoughtful and educating comments. The method I presented in my last post is more suitable to what I am doing. I stated in my first post that a subset from many lines of data is to be displayed in a numbered list. This is for my never-ending development of a DOS batch file a...
- 04 Jul 2015 15:26
- Forum: DOS Batch Forum
- Topic: Add number List in For Loop without enabledelayedexpansion
- Replies: 15
- Views: 11270
Re: Add number List in For Loop without enabledelayedexpansi
Thanks to all! I got it to work using both Yuri and aGerman's suggestions, without which the batch code failed when the ampersand occurred in the text. What I would like is an explanation of how the column of numbers gets displayed...very mysterious. From my tests, it appears that the & and ! ch...
- 03 Jul 2015 21:15
- Forum: DOS Batch Forum
- Topic: Add number List in For Loop without enabledelayedexpansion
- Replies: 15
- Views: 11270
Add number List in For Loop without enabledelayedexpansion
I am attempting to create a subset of a large list and display it with a column of numbers. There was no problem until I saw that ! marks in the text caused problems with those lines of text when delayed expansion was enabled. The problem was the disappearance of part of the text. The following code...
- 18 Jun 2015 12:35
- Forum: DOS Batch Forum
- Topic: Curious why some data dosen't echo to file
- Replies: 3
- Views: 3027
Re: Curious why some data dosen't echo to file
You've shown three ways to echo a single digit to a file. The information explains the echo command's special use of the digits 0-9. That clears up that riddle for me. Here's one more way to echo a digit to file, that I found through experimenting: @Echo Off Type NUL>"tmp.tmp" Set var=9 se...
- 17 Jun 2015 12:08
- Forum: DOS Batch Forum
- Topic: Curious why some data dosen't echo to file
- Replies: 3
- Views: 3027
Curious why some data dosen't echo to file
I am asking this out of curiosity. Why does the echo command behave this way? Thanks. @Echo Off TYPE NUL>tmp.tmp Set var1=1 Set /A var2=3 Echo A>>tmp.tmp Echo 1>>tmp.tmp Echo %var1%>>tmp.tmp Echo %var2%>>tmp.tmp Echo.& Echo file contents:& Echo.& Type tmp.tmp C:\Temp> ECHO is off. file c...
- 05 Jun 2015 11:47
- Forum: DOS Batch Forum
- Topic: Ampersand - How do you manage them as text in a variable
- Replies: 3
- Views: 3300
Re: Ampersand - How do you manage them as text in a variable
I see that both solutions handle writing text that may have an ampersand to a file.
Thank you both for giving me the tools to tame the &.
Jerry
Thank you both for giving me the tools to tame the &.
Jerry
- 04 Jun 2015 21:38
- Forum: DOS Batch Forum
- Topic: Ampersand - How do you manage them as text in a variable
- Replies: 3
- Views: 3300
Ampersand - How do you manage them as text in a variable
My batch application in progress pulls in music file names based on prompted input. Some files include the ampersand symbol. I am trying to take those prompted choices (from a larger numbered list) and write them into a m3u file, which can be played by Windows Media player, using the Start command. ...
- 03 Jun 2015 09:42
- Forum: DOS Batch Forum
- Topic: Referencing file path-need help with spaces
- Replies: 3
- Views: 3569
Re: Referencing file path-need help with spaces
Your showing how it is done and explanations of using quotes and usebackq are
10x better than /?
Thank you both. The code runs without error when a folder name includes spaces.
10x better than /?
Thank you both. The code runs without error when a folder name includes spaces.
- 02 Jun 2015 20:40
- Forum: DOS Batch Forum
- Topic: Referencing file path-need help with spaces
- Replies: 3
- Views: 3569
Referencing file path-need help with spaces
This batch file runs okay in c:\Temp. When I move it to C:\Test Folder, messages say the system cannot find the path specified. and the batch file continues but does not do what is expected, sorting a list in random order. I know it is because of the space. How do I fix it? Thanks. @Echo Off setloca...
- 29 May 2015 17:03
- Forum: DOS Batch Forum
- Topic: Shuffling text - add lower lines to the end of upper lines
- Replies: 11
- Views: 5966
Re: Shuffling text - add lower lines to the end of upper lin
Don't know if this is good coding, but it get's it done. %Echo Off setlocal enabledelayedexpansion Set /P albumName=<Source.txt Set /A itemCount=0 Set spaces= X Set spaces=%spaces:~0,34% ::convert 3-digit to 2-digit if needed. count music track lines. Type NUL>tmpalbum.txt For /f "skip=1 tokens...
- 28 May 2015 11:42
- Forum: DOS Batch Forum
- Topic: For Loop to Parse Delimited String Variable--how?
- Replies: 15
- Views: 9186
Re: For Loop to Parse Delimited String Variable--how?
When I run the code and the text file lines have no leading space, FINDSTR does not locate the line if you are searching for first words. Add a leading space in the text file and the first words can be found. If you get different results, that would be very curious. My O/S is Windows 7 32-bit. This ...
- 27 May 2015 10:09
- Forum: DOS Batch Forum
- Topic: For Loop to Parse Delimited String Variable--how?
- Replies: 15
- Views: 9186
Re: For Loop to Parse Delimited String Variable--how?
Here is what seems to work with my file of file names that includes all punctuation. It required that I add a leading space to each line (my text editor is KEDIT for windows), otherwise the first word was not found, and allow for just one word entry or one quoted set of words. @Echo Off set "pu...
- 26 May 2015 09:26
- Forum: DOS Batch Forum
- Topic: For Loop to Parse Delimited String Variable--how?
- Replies: 15
- Views: 9186
Re: For Loop to Parse Delimited String Variable--how?
I get the same output that you do with both those last examples. It ignores words joined to punctuation. I needed a way to pick up 'them, Bill and ...', so I use FINDSTR to search a file that has no commas or other punctuation; it gets the line numbers. Then text is retrieved on the same line number...
- 25 May 2015 10:34
- Forum: DOS Batch Forum
- Topic: For Loop to Parse Delimited String Variable--how?
- Replies: 15
- Views: 9186
Re: For Loop to Parse Delimited String Variable--how?
foxdrive, your first example picks up every 'them' but would ignore 'them,' . That's why I've removed punctuation and converted all spaces to underscore plus the first word has a leading _ and the last word ends with _. I am using Findstr line numbers to create the display list after parsing out the...