1.

Solve : Advanced file modification?

Answer»

Quote from: Helpmeh on April 22, 2009, 08:32:47 PM

Just CLOSES...I typed in TEST (one of the FIRST words) and hit enter...it just closed.
Code: [Select]@echo off
set /p UserInput=Enter:
if defined UserInput (
(for /f "usebackq tokens=1-4 delims= " %%a in ("list.txt") do (
if "%%a" equ "%UserInput%" (
echo.%%a %%b %%c is
) else (
echo.%%a %%b %%c %%d
)
))>"list_new.txt"
move /y "list_new.txt" "list.txt"
) else (
echo Your pressed Enter directly. Nothing changed.
pause
)
start "" "list.txt"Quote from: gh0std0g74 on April 22, 2009, 09:09:02 PM
wow, its an invisible error message.

non GUI user input version
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\list.txt"
strInput = ""
WScript.Echo "Enter fname: "
Do While Not WScript.StdIn.AtEndOfLine
strInput = strInput & WScript.StdIn.Read(1)
Loop
Set objFile = objFS.OpenTextFile(strFile,1)
Do Until objFile.AtEndOfStream
strLine = Split(objFile.ReadLine," ")
If strLine(0) = strInput Then
strLine(UBound(strLine)) = "is"
End If
WScript.Echo Join(strLine," ")
Loop
if you are interested to use vbscript, download and read the manual and see what's going on with the script i WROTE. that's learning.
It doesn't change anything...

Enter fname:
test
fnameÿlnameÿyesÿnot
ffnameÿllnameÿnoÿnot
testÿtestnameÿnoÿnot
my thought the issue here is alt+0160. Look my picture, it automatic change from alt+0160 to alt+0225.


Quote from: tonlo on April 24, 2009, 06:55:52 PM
my thought the issue here is alt+0160. Look my picture, it automatic change from alt+0160 to alt+0225.



I just realised that I don't need to modify the fourth delimiter, I can send the first delimiter to a different file. Thanks for all your help anyway!


Discussion

No Comment Found