Announcement

Collapse
No announcement yet.

"Run these programs at user logon" GP

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Run these programs at user logon" GP

    Hi everyone,

    I have a question regarding the "Run these programs at user logon" group policy.

    The policy works great with notepad.exe or Winrar, but it doesn't work with our in-house application because the application we developped require a working directory in the shortcut. (the Start In: field in the shortcut)

    Is there any way to start our application with this policy or another way while specifying a working directory?

    Many thanks,
    Toast

  • #2
    Re: "Run these programs at user logon" GP

    At "Run these programs at user logon" try this syntax to run your app:
    Code:
    cmd /c pushd "w:\orking\directory" &&start ""/normal in-house-app.exe
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: "Run these programs at user logon" GP

      Rems, you are a genius! Works like a charm.

      Btw, do you know how to do the same thing (run a program while specifying a working directory from a batch file [x.bat]) ?

      Thank you!!!
      ~Toast

      Comment


      • #4
        Re: "Run these programs at user logon" GP

        Originally posted by toastman View Post
        , do you know how to do the same thing (run a program while specifying a working directory from a batch file [x.bat]) ?
        In a batch you can use the exact same command line (but there you don't use cmd /c in front of the line):
        Code:
        pushD "w:\orking\directory" &&(
           start "" "in-house-app.exe"
           popD
        )
        pushD makes the defined path working directory. If the path would be a UNC networkpath (UNC paths can never set as the working directory) then pushD will by itself assign a drive letter to it and set the mapped drive as te working directory.

        && makes the application run only if pushD was successfull.

        popD (optional) returns the working directory of the batch to the directory before the latter pushD action. note, if the pushD stament had caused the creation of a drive mapping, then popD will not only set the previous working directory it'll also disconnect that mapped drive.

        cheers,
        \Rems

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment


        • #5
          Re: "Run these programs at user logon" GP

          Rems, once again thank you, worked perfectly!

          I have one last question, any idea how to launch "logoff" command when the app in question is terminated?

          Example: When I use the following it works, the app starts, and when I close it the system logs off:

          Code:
          @echo off
          cd %ApplicationRoot%\bin
          cmd /C application.exe
          goto exit
          
          :exit
          logoff
          I tried something like this but as you can imagine it doesn't work , it just logs off right away:
          Code:
          pushD "C:\Program Files\Positron\Power911\Bin" &&(
             start "" "p911.exe"
             popD
          )
          goto exit
          
          :exit
          logoff
          Thank you very much!
          Toast
          Last edited by toastman; 2nd February 2010, 18:09.

          Comment


          • #6
            Re: "Run these programs at user logon" GP

            For that you could use something like

            start "title" "%yourcommand or app%" && logoff

            What this does is run the logoff command after the initial start value has been processed. This also means that your batch file remains active as long as your application is.

            Maybe I'll come up with something else(better) later.
            Please give points where appropriate

            <I dont create ready scripts for you, but I'm willing to point you in the right direction>

            Comment


            • #7
              Re: &quot;Run these programs at user logon&quot; GP

              Originally posted by Silver23 View Post
              For that you could use something like

              start "title" "%yourcommand or app%" && logoff
              .
              No, that will not work icw/ Start command.

              Instead use,
              Code:
              Start ""/w p911.exe
              logoff.exe
              OR don't use Start :
              Code:
              p911.exe
              logoff.exe

              Instead of using PushD - for your batch, since this app is local you could also use this,
              Code:
              cd /d "%ApplicationRoot%\bin"
              note,
              I would like to suggest to close this thread in the GPO forum, and continue here... (existing thread of you already in scripting forum).


              \Rems

              This posting is provided "AS IS" with no warranties, and confers no rights.

              __________________

              ** Remember to give credit where credit's due **
              and leave Reputation Points for meaningful posts

              Comment

              Working...
              X