I need to change out a path in a file to the current path im using to run the batch file. I think I need to use FindStr because FOR wont handle <>: characters. Heres a string example in a file:
C:UsersabcdirOneDrive – Enc3322 OperationsBrightSign
C:UsersabcdirOneDrive – Enc3322 OperationsBrightSign
and lets say the current dir path is C:UsersdefdirOneDrive – Enc
so what i need to end up with:
C:UsersdefdirOneDrive – Enc3322 OperationsBrightSign
C:UsersdefdirOneDrive – Enc3322 OperationsBrightSign
so my thought is to findstr “C:Users*OneDrive” and replace the * with the current path C:UsersdefdirOneDrive
FOR DO doesnt like special characters and these files are full of them. Do I nest the FindStr in a For loop to have it look thought the folder and a sub folder for these files? Speed isnt really an issue. Theres less than 20 files total and if I use an extension in the file search its about 10 files.
Just not sure how to build this batch. Thanks for any guidance!!!
FOR doesnt like <> and I dont know how exactly how to build the loop. My experience is in C++ and I need to to work in a bunch of windows PC so C++ may or may not be on the machine, but a batch file would work
Rich C is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.