Results 1 to 12 of 12

Thread: batch process

  1. #1
    Join Date
    Sep 2003
    Posts
    30

    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 2002
    Posts
    5,938
    Tried read input from input file?

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    if it is a dos batch file then use %1 %2 for sending parameters to the batch file

  4. #4
    Join Date
    Sep 2003
    Posts
    30
    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 2002
    Location
    Fantasy
    Posts
    4,254
    Create a batch file like below
    c:\launch_scrt.bat and execute the batch file like this

    launch_scrt.bat Y

    or

    launch_scrt.bat N

    ----------------------------

    REM ..Batch file....begins
    REM .......Delete file........

    if %1 == N goto Bottom
    if %1 == Y goto TOP

    :TOP
    echo delete
    del x.txt /q
    GOTO END

    :Bottom
    echo dont delete
    GOTO END


    :END
    REM ..Batch file....End

  6. #6
    Join Date
    Sep 2003
    Posts
    30
    Thanks, that gave me a few ideas.

  7. #7
    Join Date
    Sep 2003
    Posts
    30
    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.

  8. #8
    Join Date
    Nov 2002
    Location
    Chesapeake, VA
    Posts
    104
    I'm a little confused. You're not using the 'del' command but rather, you are using some other command that requires a prompt?

    If using the 'del' command why don't you remove the /P switch.

    If not using 'del', what is the prompt for? Deleting? Could you create a new file, for example 'MyDownLoad.txt' and then rename the production file to 'MyOldFile.txt' then rename 'MyDownLoad.txt' to MyProductionFile.txt'?

    What am I missing?

  9. #9
    Join Date
    Sep 2003
    Posts
    30
    Well i'm running a command that generates hostnames in the batch file. This command expects an input once a month. It prompts whether to download hostnames from the internet or not ('y' or 'n').

    I have the bat file setup so that all the output from command is outputted to a log file. So once a month the log has the message that is waiting for an input and the batch process just sits there until someone manually hits 'y' on the server where the job is running.

    I want to avoid this manual process.

    Hopefully this is clear as mud.

  10. #10
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    1. who determines that 'Yes' or 'No'?
    will that be predetermined for a year?
    or else there is a manual intervention anyway to pass the parameter Yes or No

    2. There should be some switch in the executable that you are using. if not its a poorly developed application.
    try yourexecutable.exe /?
    or yourexecutable.exe /help
    or yourexecutable.exe

    3. Instead of using that executable can you use anything else? or can it be re-written.

  11. #11
    Join Date
    Sep 2003
    Posts
    30
    The 'y' or 'n' is predetermined. It's always 'y'. But it prompts for the 'y' or 'n' only once a month.

    Is there a way put 'y' whenever there is an input prompt required by the program?

    the application is SecureCRT, i dont know who has heard of it before.

    and the command in the bat file is as follows:

    E:\dir1\dir2\Prog.exe -pw username password x:\inputdir > x:\logfile.log

  12. #12
    Join Date
    Nov 2002
    Location
    Chesapeake, VA
    Posts
    104
    Are you saying that it only runs once a month or it only hangs for the prompt once a month but runs multiple times in the month. If it's the latter, does it create a file for each month. Addtionally, I noticed that it accepts a switch for password, are there other runtime options you can specify?

    Sidney Ives
    Database Administrator
    Sentara Healthcare

Posting Permissions

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