This article is a mirror article of machine translation, please click here to jump to the original article.

View: 6158|Reply: 0

Add characters in bulk before each line in a txt text file

[Copy link]
Posted on 2/4/2015 1:25:21 PM | | |

'=================================================================
set arg=WScript.Arguments
if arg.count=0 then
msgbox "Usage:"&vbcrlf&vbcrlf&" Don't run this script directly, just drag and drop one or more files that need to be replaced with strings onto this script file.
wscript.quit
end if
set fso=wscript.createobject("scripting.filesystemobject")
set fr=fso.opentextfile(arg(0),1)
set fw=fso.createtextfile("temp.txt",2)
data=inputbox("Please enter the character you added before the line:")
do
fw.writeline(data&fr.readline)
loop until fr.atendofstream
fr.close
fw.close
set fr=fso.opentextfile("temp.txt",1)
set fw=fso.createtextfile(arg(0),2)
do
fw.writeline(fr.readline)
loop until fr.atendofstream
fr.close
fw.close
fso.deletefile("temp.txt")
'====================================================
Copy the above content and save it as a VBS file, drag the document you want to modify to this VBS file, you can enter the characters you want to add, confirm after entering, open your document, and you will find that each line of your has added the data you just entered.




Previous:There are three common SQL insertion statements
Next:Import the txt file to SQL SERVER 2008
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com