troubleshooting Question

Remove the last character from a line in batch.....

Avatar of johnb6767
johnb6767Flag for United States of America asked on
Microsoft DOSWindows XPWindows OS
10 Comments1 Solution2865 ViewsLast Modified:
I have a simple text file that I have created in a batch script that is a result of the reg export of [HKEY_CURRENT_USER\printers\Connections]

Next line trims it down just fine, to the \\server\share format, but leaves the "]" at the end, that I cannot seem to remove..... Been fighting it long enough, now Ill let yall take a stab.. Sure its simple, but this one eludes me for some reason.....

So......

Goal is to get a text file with the following in it......

\\server\5034C]
\\server\5034C_PS]
\\server\PB-2050]
\\server\Xerox Phaser 6300N PS]
\\Computername\RICOH Aficio SP C222DN PCL 6]

To look like..... Just simply remove the last bracket.....

\\server\5034C
\\server\5034C_PS
\\server\PB-2050
\\server\Xerox Phaser 6300N PS
\\Computername\RICOH Aficio SP C222DN PCL 6

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros