Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Command line batch file question

  • 13-03-2017 1:25pm
    #1
    Registered Users, Registered Users 2 Posts: 689 ✭✭✭


    Wondering if anyone can help with this...

    I have a batch file I've written to act as an intermediary step for users. It's intended to check for updates to config files from the server, copy them to the local machine and then launch our application. It's performing the first two steps without an issue, how ever when it launches the application, using a preconfigured shortcut, it hangs without ever getting to the final line of the batch, exit. It does launch the application successfully, however it doesn't seem to register this and move to the next line:



    set servershare=\\server\share\config files
    set localfolder=c:\config files

    If exist "%localfolder%\created.txt" (goto :begininicopy) else (goto :beginconfigfilescopy)

    :begininicopy

    xcopy "%servershare%\config.ini" "%localfolder%" /Y

    goto :progstart

    :beginconfigfilescopy

    md "%localfolder%"
    xcopy "%servershare%" /s "%localfolder%"
    copy NUL "%localfolder%\created.txt"

    goto :progstart

    :progstart

    "%localfolder%\Program.lnk"

    exit

    So it runs all the condition checks correctly, creating the local folder if it doesn't exist, etc, but after running the shortcut ("%localfolder%\Program.lnk") it just sits there in an open command window, without ever running the exit command. Any suggestions on a method of forcing the exit command to be run post the program launch or a method for 'timing out' the program run command as we know it is working?


Comments

  • Registered Users, Registered Users 2 Posts: 2,116 ✭✭✭ItHurtsWhenIP


    Try calling the shortcut:
    call "%localfolder%\Program.lnk"
    


  • Registered Users, Registered Users 2 Posts: 689 ✭✭✭Evac101


    Try calling the shortcut:
    call "%localfolder%\Program.lnk"
    

    Cool - also was about to update that I had a colleague suggest using:
    Start "" "%Localfolder%\Program.lnk" /Y
    

    which worked. Essentially the issue seems to be that without some intermediary step (such as Start or Call) the cmd window remains open until the program which was launched, is closed, effectively pausing.

    Thanks for the assistance in any case - appreciated :)


Advertisement