vb.net - Remove specific string while writing log of .bat file -
i creating .bat
file transfer files 1 server another. after file moved, delete original .bat
file. in addition writing log .bat
file.
code works fine, issue along result password being stored in log file, can't remove same original .bat
file used transferring given credentials.
can remove same log file? below code same:
shell("filters.bat >log.txt")
here's 1 way replace text (password "***") in text file (filename). it's untested, should close.
s = system.io.file.readalltext(filename) s = s.replace(password, "****") system.io.file.writealltext(filename, s)
to replace while writing file, use string replace on whatever string you're writing:
s = system.io.file.readalltext(batchoutput) s = s.replace(password, "****") system.io.file.appendalltext(logfilename, s)
Comments
Post a Comment