Requesting help on Batch script and Batchscript to powershell

  1. Posts : 1

    Requesting help on Batch script and Batchscript to powershell

    Hi All


    I am having a below batch file code to create a desktop shortcut . The below code has Admin and trader related scripts I could not understand the flow here . Can anyone please help me with what this code is speaking. And i need the below code to change to PowerShell. Need help on this please.
    @echo off

    if[%Adminmode%] NEQ[1] goto :tradershortcut

    echo [InternetShortcut] > %SHORTCUTFILE%
    echoURL="file.///%REMOTEDIR%\environs\%ENVIRON%\scripts\admin_scripts\admin_MMI_%USERGROUP%_%ENVIRON%.bat" >> %SHORTCUTFILE%
    echo IconFile="%LOCALWKSDIR%\environs\%ENVIRON%\scripts\helperapps\icon\mmi_admin.ico" >> %SHORTCUTFILE%
    echo IconIndex=0 >> %SHORTCUTFILE%


    echo [InternetShortcut] > %SHORTCUTFILE%
    echoURL="file.///%REMOTEDIR%\environs\%ENVIRON%\scripts\trader_scripts\start_MMI_%USERGROUP%_%ENVIRON%.bat" >> %SHORTCUTFILE%
    echo IconFile="%LOCALWKSDIR%\environs\%ENVIRON%\scripts\helperapps\icon\mmi.ico" >> %SHORTCUTFILE%
    echo IconIndex=0 >> %SHORTCUTFILE%
      My Computer

  2. Posts : 7,606
    Windows 10 Home 20H2

    I can use a PowerShell script to create a desktop shortcut. Please tell me the shortcut name, target, and icon path.
      My Computer

  3. Posts : 16,892
    Windows 10 Home x64 Version 22H2 Build 19045.4170

    If you want to understand that script, you need to ask whoever wrote it.

    Each subroutine has a minimum of two fatal errors and you have not shown the whole of the script.

    You might wish to see
    Creating a shortcut for a exe using a batch file - Stack Overflow
    and then study
    How to create a desktop shortcut with the Windows Script Host - MSSupport
    Create Shortcuts .lnk or .url Files With PowerShell - PowerShell Blogger

    For general studies:-
    I recommend studying PowerShell rather than batch files - TenForums
    my consolidated links - Useful study materials for batch file scripting n PowerShell - post #8 - TenForums
    Powershell guides -
    PowerShell Scripting - The Basics - TenForumsTutorials
    PowerShell Scripting - Run a Script from Shortcut - TenForumsTutorials
    PowerShell commands index - SS64
    PowerShell forum - SS64
    PowerShell Tutorials - Windows10Forums [2017] - I am normally wary of this website for reasons that I cannot remember but their PS tutorial seems OK.
    Mastering PowerShell with Dr. Tobias Weltner [2009]PowerShell Commands - ScriptRunner

    If you want to pursue your studies further, I suggest the user forums in SS64
    Commands forum - SS64 forums
    VBScript forum - SS64 forums
    PowerShell forum - SS64 forums


    Welcome to TenForums.
    It's really worth making time to browse through the
    Tutorial index - there's a shortcut to it at the top of every page.
    - At the foot of the Tutorial index is a shortcut to download it as a spreadsheet.
    - I download a new copy each month so I can benefit from Excel's filtering capabilities when I search for topics of interest.
    - Tutorials are also listed by category at

    You have not completed your system specs.
    Last edited by Try3; 05 Apr 2021 at 11:39.
      My Computer

  4. Posts : 7,606
    Windows 10 Home 20H2

    PowerShell experts are available there: Powershell and Coding | Windows Questions
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 14:58.
Find Us

Windows 10 Forums