Search found 29 matches

by OJBakker
16 Nov 2011 15:38
Forum: DOS Batch Forum
Topic: Reverse Parsing
Replies: 10
Views: 5929

Re: Reverse Parsing

If you enumerate the file with leading zeroes the reverse ordering can be done with Sort /R
by OJBakker
08 Nov 2011 01:24
Forum: DOS Batch Forum
Topic: create a file and save in a specified directory
Replies: 1
Views: 1773

Re: create a file and save in a specified directory

use full path to test.txt

Code: Select all

echo > c:\test\test.txt
by OJBakker
04 Nov 2011 04:21
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 33
Views: 50124

Re: How to replace "=","*", ":" in a variable

Oops,
It seems I confused myself :D
by OJBakker
03 Nov 2011 16:14
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 33
Views: 50124

Re: How to replace "=","*", ":" in a variable

The = can be used in a variable name, just not as the first character

Code: Select all

set var^=name=value
set var

and even more confusing names:

Code: Select all

set !^=!
set %^=%
set ^^=^^
set !
set %
set ^^

These examples work with set but not with set/p
by OJBakker
11 Oct 2011 08:17
Forum: DOS Batch Forum
Topic: Help with mkdir
Replies: 3
Views: 1370

Re: Help with mkdir

I see 2 problems with the if/i command
1. You are missing a double-quote in the left part of the condition
2. Get rid of the spaces surrounding the ==

Code: Select all

if /i _"%config%"==_"Y" 
by OJBakker
05 Sep 2011 08:46
Forum: DOS Batch Forum
Topic: doskitXPx86
Replies: 39
Views: 24150

Re: DOS-KIT

[edit by Ed Dyreen on 18 Jan 2012] Removed outdated link ! Thanks for posting Something new to play with... Maybe someday I will understand your code, it surely looks impressive! The link you posted does not work, just redirects to the Mediafire homepage. The correct link for your mediafire folder ...
by OJBakker
05 Sep 2011 06:12
Forum: DOS Batch Forum
Topic: List Directories as Menu Options
Replies: 5
Views: 1888

Re: List Directories as Menu Options

I see two possible problems:

Code: Select all

set /a amrbusOption = 0


typing error: amrbusOption -> armbusOption

use of space before the = sign could result in a new variable named 'armbusOption '
where you intend to update the value of the variable 'armbusOption'

OJB
by OJBakker
26 Aug 2011 07:24
Forum: DOS Batch Forum
Topic: New technic: set /p can read multiple lines from a file
Replies: 37
Views: 31482

Re: New technic: set /p can read multiple lines from a file

The size-calculation is intended for internal use of the batchfile. It is used to determine when the end-of-input is reached. Both routines will process files OK if the following rules are respected. All Lines must end with CRLF (exception is the last line, there CRLF is optional) The file contains ...
by OJBakker
26 Aug 2011 07:17
Forum: DOS Batch Forum
Topic: How Set/p works
Replies: 11
Views: 13277

How Set/p works

How Set/p works I have done many test to better understand the way set/p operates especially when used with input-redirection. set/p can add a variable and give it a value. set/p can NOT remove a variable. Trying to use set/p to set a variable to an empty string will not give a clear message but se...
by OJBakker
23 Aug 2011 15:11
Forum: DOS Batch Forum
Topic: New technic: set /p can read multiple lines from a file
Replies: 37
Views: 31482

Re: New technic: set /p can read multiple lines from a file

Nice work on the timings. Here are two more variants to play with. Both are based on the set/p goto loop limited by filesize. The first counts characters per line, the counting slows it down. @echo off setlocal EnableDelayedExpansion set File=%~f1 for /F %%f in ("%File%") do set FileSize=%...
by OJBakker
19 Aug 2011 15:04
Forum: DOS Batch Forum
Topic: New technic: set /p can read multiple lines from a file
Replies: 37
Views: 31482

Re: New technic: set /p can read multiple lines from a file

1) This does NOT work <%file% ( for /f "skip=2" %%i in ('find /n /v "" %file%') do ( set "ln=" set /p "ln=" echo(!ln! ) )>%out% It reads and writes the correct number of lines - but the lines are empty I don't understand the mechanism of failure. I have done ...
by OJBakker
16 Aug 2011 14:55
Forum: DOS Batch Forum
Topic: Reads commands from an external file
Replies: 9
Views: 2401

Re: Reads commands from an external file

The code in your original post is working.
Try again with the code you posted and just remove the @ sign.
If it does not work be more specific.
Post your test code and output.

OJB
by OJBakker
16 Aug 2011 14:30
Forum: DOS Batch Forum
Topic: Reads commands from an external file
Replies: 9
Views: 2401

Re: Reads commands from an external file

In 'example_cmd_file.bat' remove the @ sign from the echo line

I don't know why the @ prefix in @echo off causes the unknown command error

OJB
by OJBakker
14 Aug 2011 13:16
Forum: DOS Batch Forum
Topic: Read a file into a variable
Replies: 4
Views: 1874

Read a file into a variable

This batchfile will read itself and store all it's lines including crlf in a variable. It uses a variation on the 'set /p can read multiple lines from a file' trick mentioned by Jeb. The core snippet echo The batchfile will be read into %%File%% set "ShowLineNr=" set "File=" ( fo...