|I have a script that exports the first 3 octets of an IP address to a file (IP.txt). When it exports, it is adding a space at the end of the line, as well as a new line. When the test is imported from the file, the space is included. The issue that I have with this is that the length of the IP is not static. I am needing a way to remove the space at the end of the line, or to prevent it from being the txt file without manually modifying it.|
I am writing the info to file via:
SET /p OCT2=Please enter IP Octet 2:
SET /p OCT3=Please enter IP Octet 3:
ECHO %IP_BASE% > IP.txt
I am importing the text back at a script opening via:
IF EXIST IP.txt (
SET /p IP=<"IP.txt"
) ELSE (
Say that I set OCT2 as 22 and OCT3 as 33, this SHOULD output as "10.22.33."
It is, however outputting as "10.11.22.
When calling this info into a batch script, it then comes back as "10.22.33. "
Is there a way that I can script the removal of the last character (the " ") or to prevent it from being written in the first place?