change.com Question

June 5, 2009 at 13:13:58
Specs: Windows XP, 1024
i know how to use it

but is it possiable to use display a message stating they typed in the wrong name to search for? because its no there in the file?


See More: change.com Question

Report •


#1
June 5, 2009 at 16:03:12
If this is in xp I would seriously consider using sfk instead of change.com, it can do many thing replacing text is one of them....

It states this in the help "sfk replace"

  return codes for batch files
     0 = no matches, 1 = matches found, >1 = major error occurred.

This thing has quite a few features, it may be worth running "sfk dumphelp" to a text file and give it a read.


If you *must* use change.com check to see if it also leaves an errorlevel set differently for replace/no replace.


Report •

#2
June 6, 2009 at 02:07:31
is there a batch code that does what Change.com does?


Report •

#3
June 6, 2009 at 02:13:39
An NT batch can do some text replacement but if the file has chars with "special meaning", like the <> which will always be in html files, things get pretty hairy.


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

M2


Report •

Related Solutions

#4
June 6, 2009 at 18:07:41
you wouldnt hapen to have an example would you?

all i want is

have user input search %string%
user input Replace with %sting2%

in C:\test.txt

i cant seem to figure out how to replace sting


Report •

#5
June 6, 2009 at 23:48:43
@echo off > newfile & setLocal EnableDelayedExpansion

set /p old=old string ? :
set /p new=new string ? :

for /f "tokens=* delims= " %%a in (myfile) do (
set str=%%a
set str=!str:%old%=%new%!
echo !str!>> newfile
)


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

M2


Report •

#6
June 7, 2009 at 02:32:56
That works but how can i remove the old string?

Report •

#7
June 7, 2009 at 02:39:52
set str=!str:%old%=!


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

M2


Report •

#8
June 7, 2009 at 12:23:46
that doesn't work unless i'm doing something wrong.

or i could use CHANGE.com but i convert the batch to a EXE using BAT to EXE and i add the changel.com file but the EXE wont use the CHANGE.com any ideas why? or what other file dos i need to add to the EXE? to get change.com to work inside the EXE.


Report •

#9
June 7, 2009 at 14:54:24
I wasred a few hundred hours a long time ago with bat2exe; I don't recommend it.

Not obvious how you got this wrong:

set str=!str:%old%=!


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

M2


Report •

#10
June 7, 2009 at 15:28:48
well im using change.com to edit a the host file. im am able to add ip's but i cant seem to allow change.com to change or remove address.

its like either windows stops it or somthing. im not sure.

that way i was using that code for, maybe you can figure it out.

i just need to be able to ADD EDIT and DELETE ip for the host file.

with the FOR command you gave me. havin issues still.


Report •


Ask Question