Computer Hope
Microsoft => Microsoft DOS => Topic started by: Xenfire on May 06, 2009, 05:03:40 PM
-
I have a text file that has multiple lines in it.
This is line 1
This is line 2
This is line 3
After prompted, a user enters "This is line 2" I want that line to be removed from the file.
However, the lines won't always be in the same place.
Example: (it could be like this)
This is line 3
This is line 1
This is line 2
Help?
-
vbscript
Set objFS = CreateObject("Scripting.FileSystemObject")
WScript.Echo "Enter line to delete: "
Do While Not WScript.StdIn.AtEndOfLine
strInput = strInput & WScript.StdIn.Read(1)
Loop
strFile = "c:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfLine
strLine = objFile.ReadLine
If Not InStr(strLine,strInput) > 0 Then
WScript.Echo strLine
End If
Loop
-
Thanks, but I need the method to be in batch.
Thanks anyways.
-
nobody knows?
=[
-
I have a text file that has multiple lines in it.
This is line 1
This is line 2
This is line 3
After prompted, a user enters "This is line 2" I want that line to be removed from the file.
However, the lines won't always be in the same place.
Example: (it could be like this)
This is line 3
This is line 1
This is line 2
Help?
Could this be a de-register?
And can't you just run that from the command prompt?
-
Sort of a de-register.
Not exactly, but it's part of it.
It's all experimenting with the banning thing.
And what do you mean "Can't you do that from command prompt"
-
@echo off & setlocal
set/p s=enter string :
type test.txt|find/i /v "%s%">$$$
move $$$ test.txt
-
@echo off & setlocal
set/p s=enter string :
type test.txt|find/i /v "%s%">$$$
move $$$ test.txt
I'll try that.
EDIT: Works great. Much thanks Reno.
-
I'll try that.
EDIT: Works great. Much thanks Reno.
But...the ban function should display that they're banned, this code will just remove them from the registered list.
-
I didn't post my code, how would you just figure that I didn't put any notification of ban.
The code is much longer than just removing the user from the list.
and it actually works unlike your ban featawr/
-
I didn't post my code, how would you just figure that I didn't put any notification of ban.
The code is much longer than just removing the user from the list.
and it actually works unlike your ban featawr/
I think I know how it could work...register sends their username to a file...if their name is registered, but not in the file, then they've been banned and are locked out...and did TheFish rage when I didn't unlock it yesterday?
-
Fishy exploded with fury.
And the ban does this
when a user is banned, it makes a file with their name in a hidden file (that's why I need the attrib +h thing) Then the other chat components check for the existence of the file.
Pretty simple really.
-
Fishy exploded with fury.
And the ban does this
when a user is banned, it makes a file with their name in a hidden file (that's why I need the attrib +h thing) Then the other chat components check for the existence of the file.
Pretty simple really.
wow...that is much simpler than I expected from you...but it should work in theory...unless they search for their own name and delete it...although they would have to know where it would be placed........
-
Which is why I needed the files hidden.
So they won't know the location
and THE SIMPLER THE BETTER.
Why make it complicated when you don't need to?
-
Which is why I needed the files hidden.
So they won't know the location
and THE SIMPLER THE BETTER.
Why make it complicated when you don't need to?
they won't know the location, but they can still find it...but making it hidden will work pretty well.
-
especially at school, where the option to view hidden files is restricted for most computers. Except for yours and Zack's
-
especially at school, where the option to view hidden files is restricted for most computers. Except for yours and Zack's
Yeah...sure... :-X