Strip extra characters from end of line in file

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have 2 files that I need to put the results together
into a single file to create a file path and the name of
the file to be able to copy the file local.

Result.fil contains:
cdisitin.def f:\wicshare\garprod

Problem is the variable that creates the path part puts
extra spaces after the end of the path. When I try to put
them together the result is:
f:\wicshare\garprod \cdisitin.def

How can I remove these extra spaces? I need this to be
done in a batch file not manually.
 
I have 2 files that I need to put the results together
into a single file to create a file path and the name of
the file to be able to copy the file local.

Result.fil contains:
cdisitin.def f:\wicshare\garprod

Problem is the variable that creates the path part puts
extra spaces after the end of the path. When I try to put
them together the result is:
f:\wicshare\garprod \cdisitin.def

How can I remove these extra spaces? I need this to be
done in a batch file not manually.


set var=%var: =%#
set var=%var: #=%
set var=%var:#=%


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hello Chris.

Chris said:
I have 2 files that I need to put the results together
into a single file to create a file path and the name of
the file to be able to copy the file local.

Result.fil contains:
cdisitin.def f:\wicshare\garprod

Problem is the variable that creates the path part puts
extra spaces after the end of the path. When I try to put
them together the result is:
f:\wicshare\garprod \cdisitin.def

How can I remove these extra spaces? I need this to be
done in a batch file not manually.

How did the extra spaces get there? Maybe this way:
ECHO f:\wicshare\garprod >file2.txt
Then try this instead:
ECHO f:\wicshare\garprod>file2.txt

Or as I mentioned somewhere else:
for /f %%x in (file2.txt) do for /f %%y IN (file1.txt) do echo
%%x%%y>file3.txt
Beware of spaces in the path or filename.
 
Back
Top