Forgive me for the second post but I am having another problem I cant resolve.
I have the following in a batch file:
Code: Select all
@echo off
cls
color 0a
echo "Contacting XXXXXXX APN"
echo "Please wait >>>>>"
ping localhost –n 25 >NUL
rasdial XXXXX XXXXX\YYYYY XXXXXX
I have another batch which prompts for a username and uses it for domain settings but I also need to change "YYYYYY" with a new user. I am using the following to do this:
Code: Select all
set /p ID="Enter TB"
wmic path win32_computersystem where Name="%computername%" CALL rename Name="TB%ID%"
set txtfile=%CD%\test.bat
set newfile=%CD%\new_test.bat
if exist "%newfile%" del /f /q "%newfile%"
set "search=TB009786"
set "replace=TB%ID%"
for /f "tokens=*" %%a in (%txtfile%) do (
set newline=%%a
call set newline=%%newline:%search%=%replace%%%
call echo %%newline%% >>%newfile%
)
This creates a new file with the amendment but with one error:
Code: Select all
@echo off
cls
color 0a
echo "Contacting XXXXX APN"
echo "Please wait >>>>>"
ping localhost –n 25
rasdial XXXXX XXXXX\YYYYY XXXXXX
The ">NUL" gets lost during the process and I am not sure why.
Could anyone help??
Regards
Padd