G
Guest
Hi all,
I am trying to write a interactive DOS scrip that asks the user to answer
some question (using SET /P command). When I provide the answers in a text
file using the input (stdin) redirection, the input redirection seems to be
broken after a call of attrib command. Does any body encounter this problem?
My test case is simple.
I use the following script:
prompt >type testsilent.cmd
@echo off
set A=n
set B=n
set C=n
set D=n
set /P A="A="
echo.
set /P B="B="
echo.
attrib +R file.txt
set /P C="C="
echo.
set /P D="D="
echo.
echo A=%A%
echo B=%B%
echo C=%C%
echo D=%D%
The answer file is:
prompt >type answers.txt
y
y
y
y
Here the file.txt could be any file.
If I run this scrip using the following command:
prompt>testsilent.cmd < answers.txt
the result is :
A=
B=
C=
D=
A=y
B=y
C=n
D=n
Where we expect
A=
B=
C=
D=
A=y
B=y
C=y
D=y
If I comment the attrib call, the result is the one we expected.
Does any body know about this issue, if it is a known problem and if there
is any fix?
Thanks
Adnene BEN ABDALLAH
I am trying to write a interactive DOS scrip that asks the user to answer
some question (using SET /P command). When I provide the answers in a text
file using the input (stdin) redirection, the input redirection seems to be
broken after a call of attrib command. Does any body encounter this problem?
My test case is simple.
I use the following script:
prompt >type testsilent.cmd
@echo off
set A=n
set B=n
set C=n
set D=n
set /P A="A="
echo.
set /P B="B="
echo.
attrib +R file.txt
set /P C="C="
echo.
set /P D="D="
echo.
echo A=%A%
echo B=%B%
echo C=%C%
echo D=%D%
The answer file is:
prompt >type answers.txt
y
y
y
y
Here the file.txt could be any file.
If I run this scrip using the following command:
prompt>testsilent.cmd < answers.txt
the result is :
A=
B=
C=
D=
A=y
B=y
C=n
D=n
Where we expect
A=
B=
C=
D=
A=y
B=y
C=y
D=y
If I comment the attrib call, the result is the one we expected.
Does any body know about this issue, if it is a known problem and if there
is any fix?
Thanks
Adnene BEN ABDALLAH