Results 1 to 9 of 9

Thread: Batch Process

  1. #1
    Join Date
    Sep 2003
    Posts
    212

    Unanswered: Batch Process

    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 advance

  2. #2
    Join Date
    Sep 2003
    Posts
    522
    you can have environment variable, parameter file, or the presence/abscence of the file to replace those values.

  3. #3
    Join Date
    Sep 2003
    Location
    KY
    Posts
    146

    May be

    I may be able to help you if you provide a little code as where it gets stuck for response ?

  4. #4
    Join Date
    Sep 2003
    Posts
    212
    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?

  5. #5
    Join Date
    Sep 2003
    Location
    KY
    Posts
    146

    Hi

    /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

  6. #6
    Join Date
    Sep 2003
    Posts
    212

    Re: Hi

    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.

  7. #7
    Join Date
    Oct 2003
    Posts
    706

    Re: Hi


    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.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  8. #8
    Join Date
    Sep 2003
    Posts
    212

    Re: Hi

    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.

  9. #9
    Join Date
    Sep 2003
    Location
    KY
    Posts
    146

    why

    why don't to keep 2 batch files one with Y and another with N

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •