Computing.Net > Forums > Programming > Creat exact txt entry ??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creat exact txt entry ??

Reply to Message Icon

Name: kgp
Date: February 14, 2007 at 11:46:35 Pacific
OS: XP
CPU/Ram: n/a
Product: n/a
Comment:

Hi,

I am trying to get

echo drive >drive.txt

to put the word "drive" into the drive.txt without the space and new line after it ?? I am trying to get "drive" on the first line of the text document with nothing after it !!

Please, any help would be very much appreciated.

Fight Crime,
Shoot Back !



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: February 14, 2007 at 14:34:28 Pacific

Response Number 2
Name: Mechanix2Go
Date: February 15, 2007 at 00:29:11 Pacific
Reply:

No can do without external commands.

::==================
@echo off > d.d

>> d.d echo e 100 "set myvar="
>> d.d echo n setmyvar.bat
>> d.d echo rcx
>> d.d echo a
>> d.d echo w
>> d.d echo q
debug < d.d
::=====================


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: kgp
Date: February 15, 2007 at 01:31:11 Pacific
Reply:

Ok, I copied M2's code into a test batch file and ran it with different things in the "" space.

@echo off > d.d

>> d.d echo e 100 "j"
>> d.d echo n drive.bat
>> d.d echo rcx
>> d.d echo a
>> d.d echo w
>> d.d echo q
debug < d.d

gave

j¿Œ™‹÷ƒÆ ‹

as the output. But this...

@echo off > d.d

>> d.d echo e 100 "set drive="
>> d.d echo n drive.bat
>> d.d echo rcx
>> d.d echo a
>> d.d echo w
>> d.d echo q
debug < d.d

gave

set drive=

with no spaces or anything after it !! Exactly what I am after except for the single drive letter.

It would be perfect if

set usbdrive=j

@echo off > d.d

>> d.d echo e 100 "set drive=%usbdrive%"
>> d.d echo n drive.bat
>> d.d echo rcx
>> d.d echo a
>> d.d echo w
>> d.d echo q
debug < d.d

where

set drive=j

is the output string !!

Is it possible ?? Thanks


Fight Crime,
Shoot Back !


0

Response Number 4
Name: Mechanix2Go
Date: February 15, 2007 at 01:58:26 Pacific
Reply:

Well... almost.

The point of using debug is to create a file without a line break. So you can:

copy file1+file2 file3

and have it all on one line. [That's what you asked.]

But if you've got %usbdrive% set you can simply:

echo set drive=%usbdrive%>some.bat

But we're going in circles. I'll let you decide which thread to continue this in.



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 5
Name: Godfoster
Date: May 24, 2007 at 14:25:53 Pacific
Reply:

More details on how to create a "line fragment" can be found here:

http://www.ericphelps.com/batch/lines/frag-dbg.htm


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Creat exact txt entry ??

search for 3 files and create a .txt file www.computing.net/answers/programming/search-for-3-files-and-create-a-txt-file/19141.html

Batch that grabs a random line? www.computing.net/answers/programming/batch-that-grabs-a-random-line/16888.html

Batch created multiple .txt files www.computing.net/answers/programming/batch-created-multiple-txt-files/17905.html