I have a problem running a batch file, now the problem is that when i run the batch file the command prompts the user for an input, but I have all the output of the bat file going into a log file. So when i run the bat file the process just sits there until i hit the 'y' key or unless i nput sumthin manually. This is a problem becuase this batch file is running on the UAT server as a job and there is no one there to input once the job is running. The commnd in the batch only requires an input once a month.
for eg if run: launch_scrt.bat and i want to put sum parameters such as 'y' or 'n' to avoid the manual input once the job is running. Any ideas?
Thanks in advanceyou can have environment variable, parameter file, or the presence/abscence of the file to replace those values.|||I may be able to help you if you provide a little code as where it gets stuck for response ?|||For example:
Say my batch test.bat file contains the following:
del test.txt /P
now this command asks for confirmation from the user whether to delete the file or not and it could wait for input forever. So is there way to have 'y' or 'n' in the batch file that could be changed depending on the user running this batch process?|||/P is used to Prompt "y", "N" .. remove that and if that doesn't work use /Q
: /Q Quiet mode, do not ask if ok to delete on global wildcard|||Originally posted by aashu
/P is used to Prompt "y", "N" .. remove that and if that doesn't work use /Q
: /Q Quiet mode, do not ask if ok to delete on global wildcard
but i want to use /P and send 'y' or 'n' as a parameter.|||but i want to use /P and send 'y' or 'n' as a parameter.
Now you are probably getting into a realm where you should use a better scripting-language. Not too many are available in Windows environments but there are bound to be some. Python, for example.|||Well i got simple script in my bat process:
---------
REM ..Batch file...begins
REM ......Delete file......
if %1 == N goto Bottom
if %1 == Y goto TOP
:TOP
echo delete
del rundts.bat /q
GOTO END
:Bottom
echo dont delete
GOTO END
:END
REM ..Batch file...End
----------
but now the problem is that the command I'm using instead of del is a different exe and this program is being run through command prompt. This program generates hostnames. But once every month the hostnames are to be downloaded from the interent. So once every month some one has to sit on the server where this process is running and enter 'y' or 'n'. Before downloading the hostnames from the internet it prompts the user for a 'y' or 'n'. So onec a month this has to be done manually (which is a pain). So thats why I wanted to write a script so that this can be avoided.|||why don't to keep 2 batch files one with Y and another with N
没有评论:
发表评论