start shortcut from .bat

Home Forums Scripting General Scripting start shortcut from .bat

This topic contains 20 replies, has 5 voices, and was last updated by Avatar mla 3 years, 9 months ago.

Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • Avatar
    mla
    Participant
    #165870

    I have shortcut that I need to run from batch. Searched the web, saw couple of examples not very clear.
    Could somebody provide clear syntax in .bat?

    Also, I know that Shorcuts have .lnk extention. Is it normal that extention doesn’t appear in the explorer when file extentions are unhidden.
    The type for the file shown Shortcut. Why the .lnk not show up (just for the info).

    Avatar
    biggles77
    Spectator
    #214066

    Have a read of this and see if it helps.

    Avatar
    mla
    Participant
    #309849

    unfortunately, it is a different question….
    Mine is not about a shortcut placement but launching a shortcut from a batch file.
    Would like to have this thingy work…

    Avatar
    joeqwerty
    Moderator
    #304470

    A shortcut is a “shortcut” to an object ( a file, an executable, a website, etc.). I don’t understand what you mean when you say that you want to “launch a shortcut”. Why aren’t you launching the target of the shortcut directly instead of trying to “launch” the shortcut?

    Avatar
    mla
    Participant
    #309851

    because there is no way to publish a shortcut in the GUI of RemoteApp. Only a program (so .bat is fine)
    The Executable is on server. But Start in is a local Path (yes Legacy app).

    So, if I will have .bat with the syntax that will launch the shortcut – simulation a click, I can publish the thing.
    Yes there is a powershell command for publishing but it not works for shortcut (some people saying it works).
    So trying to find a work around.

    Avatar
    Ossian
    Moderator
    #190974

    Are group policy preferences an option for you?

    Avatar
    mla
    Participant
    #309852

    non desirable.. but if for Computers… I can try. In my case it should be applied on 4 RDSH hosts and shortcut should be constantly available, because it will be pubslished as a RemoteAPP.

    Avatar
    biggles77
    Spectator
    #214067

    Ok, I just typed up a lot of words only to find I was confusing myself. I is not any good at scripting and have obviously misunderstood what you are trying to accomplish. Can you describe fully what and how you want to run this program. Fake names to protect the guilty can be used. :)

    Avatar
    mla
    Participant
    #309853

    Imagine :)

    1. a shortcut to notepad.exe on desktop

    2. the notepad should be started from batch file that will launch the shortcut to notepad.exe

    Avatar
    biggles77
    Spectator
    #214071

    Where is the launching bat file located?
    Is it to be an automatic launch, say when you logon, or a launch as/when required?

    Avatar
    mla
    Participant
    #309854

    c:file.bat
    it will be used by other program and presented to a user which will execute this bat when needed.

    Avatar
    biggles77
    Spectator
    #214074

    I wish I got paid the same as a dentist.

    So, how does this other app know when it needs to open “notepad”?

    Avatar
    mla
    Participant
    #309855

    there was a question above what I need it for…. I explained…

    Look at this as general question: is it possible to launch a shortcut from the batch file? Some people on web did it. Not always worked… I asked here because many times got help on Petri.co…

    here is what I described earlier. I need it for RemoteAPP if you tried it you can follow the need… if not forget … but generally I need to do that seems doable and I asked it on general Scripting part :
    of the forum:

    because there is no way to publish a shortcut in the GUI of RemoteApp. Only a program (so .bat is fine)
    The Executable is on server. But Start in is a local Path (yes Legacy app).

    So, if I will have .bat with the syntax that will launch the shortcut – simulation a click, I can publish the thing.
    Yes there is a powershell command for publishing but it not works for shortcut (some people saying it works).
    So trying to find a work around.

    some offer to do in batch:
    rundll32 shell32.dll,ShellExec_RunDLL “C:prog.lnk”
    http://www.computing.net/answers/programming/open-shortcut-with-batch-file/16269.html

    Avatar
    biggles77
    Spectator
    #214077
    Quote:
    there was a question above what I need it for…. I explained…

    In our world of TCP, when a message is sent and isn’t received correctly then the receiver asks for that message to be retransmitted. It is the RESPONSIBILITY of the sender to make sure that the message is UNDERSTOOD. Your miniscule answers to questions asked makes it bloody difficult to understand what you are trying to say.

    I wish you well with your endeavour.

    JeremyW
    JeremyW
    Moderator
    #271407

    Like Joe mentioned earlier, instead of trying to launch a shortcut from a batch, you should be launching the program from the batch.
    e.g. You have a batch that is trying to launch the “notepad shortcut”
    start C:NotepadShortcut.lnk[/CODE]
    In the shortcut you have the path to the program, maybe some parameters, and a starting directory.
    In your batch file, you should just do this:
    [CODE]start “My title” /D C:Windows C:Windowsnotepad.exe C:sometextfile.txt[/CODE][CODE]start C:NotepadShortcut.lnk[/CODE]
    In the shortcut you have the path to the program, maybe some parameters, and a starting directory.
    In your batch file, you should just do this:
    start “My title” /D C:Windows C:Windowsnotepad.exe C:sometextfile.txt[/CODE][CODE]start “My title” /D C:Windows C:Windowsnotepad.exe C:sometextfile.txt[/CODE]

    Avatar
    mla
    Participant
    #309858

    Jeremy,
    1. the app uses Oracle that is installed on client machine.
    2. the executable resides on the server \server_nameapp.exe
    3. the shortcut to the executable is placed on client’s Desktop and is customized
    4. as mentioned the final goal is to start this modified shortcut from the batch file.
    Why?
    Because in Microsoft RDS 2012 R2 Remote App console only a program (exe, bat) could be published as remote app.
    Below are properties from working shortcut.
    Don’t think that you will be scary :) of long path. The app is virtualized with Appv but it has nothing to do with my question. It works on local machines and TS server itself as regular local installation (non virtualized).
    You can see that there is no executable in “Start In” path (local machine). Executable draccess.exe resides on the remote server (“Target”)

    So may be you can use your Start proposition for providing a syntax after having more info about my shortcut and need to start the program with parameters in it from batch.
    Sorry if something is not clear language wise, English is forth language (after Russian first and etc) but I guess you can understand my need.
    And special sorry for Mr. biggles77 if I created a confusion related to my “poetic” :) English. I feel that I described a technical issue pretty comprehensible…

    Target:

    \entrepotlogic$WINLOGICrlgi01applbindracces.exe -i:\entrepotlogic$WINlogicrlgi01cfgini rlgi01.ini -e /appvve:F66C4693-0AAA-4996-BBAF-FBABB5CD8F3A_8E705B9E-BCC8-449F-A91E-0365334E2746

    Start In:

    %ALLUSERSPROFILE%MicrosoftAppVClientIntegratio nF66C4693-0AAA-4996-BBAF-FBABB5CD8F3ARootVFSAppVPackageDriveoracleprod uctslgiora920bin

    JeremyW
    JeremyW
    Moderator
    #271408

    So for your situation, you would put this in a batch script:
    start “Launch DRAccess” /D “%ALLUSERSPROFILE%MicrosoftAppVClientIntegrationF66C4693-0AAA-4996-BBAF-FBABB5CD8F3ARootVFSAppVPackageDriveoracleproductslgiora920bin” \entrepotlogic$WINLOGICrlgi01applbindracces.exe -i:\entrepotlogic$WINlogicrlgi01cfginirlgi01.ini -e /appvve:F66C4693-0AAA-4996-BBAF-FBABB5CD8F3A_8E705B9E-BCC8-449F-A91E-0365334E2746[/CODE][CODE]start “Launch DRAccess” /D “%ALLUSERSPROFILE%MicrosoftAppVClientIntegrationF66C4693-0AAA-4996-BBAF-FBABB5CD8F3ARootVFSAppVPackageDriveoracleproductslgiora920bin” \entrepotlogic$WINLOGICrlgi01applbindracces.exe -i:\entrepotlogic$WINlogicrlgi01cfginirlgi01.ini -e /appvve:F66C4693-0AAA-4996-BBAF-FBABB5CD8F3A_8E705B9E-BCC8-449F-A91E-0365334E2746[/CODE]

    Avatar
    mla
    Participant
    #309859

    Thanks!
    I will try it Monday and post an update.

    Avatar
    mla
    Participant
    #309860

    Ta-Da!
    It works just fine “with a little help of my friends” :)

    Is it possible to hide CMD window by chance?… I think not because START calls this window…
    and looking for changing .bat icon .
    Found reliable program for bat to exe conversion don’t see the option for specifying a target’s icon.
    Other freebies on web could be not so clean but I know we can change the icon.
    Any suggestion on this.

    Thanks Jeremy!

    JeremyW
    JeremyW
    Moderator
    #271409

    You can try using the /B switch to see if that works for you:

    start “Launch DRAccess” /D “%ALLUSERSPROFILE%MicrosoftAppVClientIntegrationF66C4693-0AAA-4996-BBAF-FBABB5CD8F3ARootVFSAppVPackageDriveoracleproductslgiora920bin” /B \entrepotlogic$WINLOGICrlgi01applbindracces.exe -i:\entrepotlogic$WINlogicrlgi01cfginirlgi01.ini -e /appvve:F66C4693-0AAA-4996-BBAF-FBABB5CD8F3A_8E705B9E-BCC8-449F-A91E-0365334E2746[/CODE]

    [CODE]start “Launch DRAccess” /D “%ALLUSERSPROFILE%MicrosoftAppVClientIntegrationF66C4693-0AAA-4996-BBAF-FBABB5CD8F3ARootVFSAppVPackageDriveoracleproductslgiora920bin” /B \entrepotlogic$WINLOGICrlgi01applbindracces.exe -i:\entrepotlogic$WINlogicrlgi01cfginirlgi01.ini -e /appvve:F66C4693-0AAA-4996-BBAF-FBABB5CD8F3A_8E705B9E-BCC8-449F-A91E-0365334E2746[/CODE]

    Avatar
    biggles77
    Spectator
    #214090

    Nice job Jeremy! :beer::beer::beer::beer::beer::beer::beer: and if you are still standing…….:bowdown::bowdown: :mrgreen:

Viewing 21 posts - 1 through 21 (of 21 total)

You must be logged in to reply to this topic.