Computer Hope

Microsoft => Microsoft DOS => Topic started by: Blisk on March 13, 2019, 03:59:26 AM

Title: remove charter from a text files
Post by: Blisk on March 13, 2019, 03:59:26 AM
how to remove a $ charter from a text file?
I have a batch which write last logged in user into txt file so backup script knows which user profile to backup.
But problem is because sometimes login makes temporary profile and user get in login.txt name like
c:\log\mike\login.txt
mike$s
c:\log\john\login.txt
john$a
c:\log\julia\login.txt
julia$f

how to search for files login.txt which are in multiple folders and remove $ from string in login.txt file so I can get result
c:\log\mike\login.txt
mikes
c:\log\john\login.txt
johna
c:\log\julia\login.txt
juliaf
Title: Re: remove charter from a text files
Post by: Salmon Trout on March 13, 2019, 10:44:55 AM
Code: [Select]
C:\>set string=joh$n
C:\>echo %string%
joh$n
C:\>set string=%string:$=%
C:\>echo %string%
john
Title: Re: remove charter from a text files
Post by: Blisk on March 13, 2019, 11:11:34 AM
this way I can slve only one login.txt file for john, what about others?
to search only $ and delete it out
Title: Re: remove charter from a text files
Post by: Salmon Trout on March 13, 2019, 11:18:02 AM
Use FOR in the normal way to process all the text files.