Command line Flags: Difference between revisions

From Unofficial EFPSE wiki Extended
Jump to navigation Jump to search
(Created page with "<span id="using-flags-with-efpse"></span> == Using Flags with EFPSE == EFPSE can be passed a few different flags to the executable. These flags are as follows: <span id="example-flags"></span> === Example Flags === # '''Game.exe -console''' #* Command: <code>"C:/../../Desktop/Projects/Game.exe" -console</code> #* Description: Will launch the game with the console open. # '''Game.exe -data ProjectName''' #* Command: <code>"C:/../../Desktop/Projects/Game....")
 
(Fix the formatting this should be good enough to show to the public)
Line 84: Line 84:
<li><p>'''Open PowerShell''': Press <code>Win + R</code>, type <code>powershell</code>, and press Enter.</p></li>
<li><p>'''Open PowerShell''': Press <code>Win + R</code>, type <code>powershell</code>, and press Enter.</p></li>
<li><p>'''Check for PowerShell Profile''': First, check if you have a PowerShell profile file. In PowerShell, type:</p>
<li><p>'''Check for PowerShell Profile''': First, check if you have a PowerShell profile file. In PowerShell, type:</p>
<syntaxhighlight lang="powershell">Test-Path $PROFILE</syntaxhighlight>
<code>Test-Path $PROFILE</code>
<p>If it returns <code>True</code>, a profile already exists. If it returns <code>False</code>, create one using:</p>
<p>If it returns <code>True</code>, a profile already exists. If it returns <code>False</code>, create one using:</p>
<syntaxhighlight lang="powershell">New-Item -Path $PROFILE -ItemType File -Force</syntaxhighlight></li>
<code>New-Item -Path $PROFILE -ItemType File -Force</code></li>
<li><p>'''Open the Profile File''': Open the profile file in a text editor to add your custom command. Use:</p>
<li><p>'''Open the Profile File''': Open the profile file in a text editor to add your custom command. Use:</p>
<syntaxhighlight lang="powershell">notepad $PROFILE</syntaxhighlight></li>
<code>notepad $PROFILE</code></li>
<li><p>'''Define Your Custom Command''': Add a function to the profile file for your custom command. For example:</p>
<li><p>'''Define Your Custom Command''': Add a function to the profile file for your custom command. For example:</p>
<syntaxhighlight lang="powershell">function game {
<code>function game {</code>
  param (
 
      [Parameter(ValueFromRemainingArguments=$true)]
<code>   param (</code>
      [string[]]$args
 
  )
<code>       [Parameter(ValueFromRemainingArguments=$true)]</code>
  & "C:\Users\SeltT\OneDrive\Desktop\Projects\Game.exe" @args
 
}
<code>       [string[]]$args</code>
</syntaxhighlight></li>
 
<code>   )</code>
 
<code>   & "C:\Users\SeltT\OneDrive\Desktop\Projects\Game.exe" @args</code>
 
<code>}</code>
</li>
<li><p>'''Save and Close''': Save the changes and close the text editor.</p></li>
<li><p>'''Save and Close''': Save the changes and close the text editor.</p></li>
<li><p>'''Reload Profile''': Reload the profile to apply the changes. In PowerShell, type:</p>
<li><p>'''Reload Profile''': Reload the profile to apply the changes. In PowerShell, type:</p>
<syntaxhighlight lang="powershell">. $PROFILE</syntaxhighlight></li></ol>
<code>. $PROFILE</code></li></ol>


<span id="using-your-custom-command"></span>
<span id="using-your-custom-command"></span>
Line 109: Line 115:
<ul>
<ul>
<li><p>To launch the game with the console:</p>
<li><p>To launch the game with the console:</p>
<syntaxhighlight lang="powershell">game -console</syntaxhighlight></li>
<code>game -console</code></li>
<li><p>To launch the game with a specific project name:</p>
<li><p>To launch the game with a specific project name:</p>
<syntaxhighlight lang="powershell">game -data ProjectName</syntaxhighlight></li>
<code>game -data ProjectName</code></li>
<li><p>To launch the game from a specific map number:</p>
<li><p>To launch the game from a specific map number:</p>
<syntaxhighlight lang="powershell">game -map 1</syntaxhighlight></li></ul>
<code>game -map 1</code></li></ul>


<span id="using-the-multiple-flags"></span>
<span id="using-the-multiple-flags"></span>
Line 120: Line 126:
<ul>
<ul>
<li><p>To launch the game with multiple flags:</p>
<li><p>To launch the game with multiple flags:</p>
<syntaxhighlight lang="powershell">game -console -data -map 1</syntaxhighlight></li></ul>
<code>game -console -data -map 1</code></li></ul><span id="disclaimer"></span>
 
<span id="summary"></span>
=== Summary ===
 
<span id="disclaimer"></span>
== Disclaimer ==
== Disclaimer ==


AI DISCLAIMER: AI was used to format, arrange, and make edits to the above text
AI DISCLAIMER: AI was used to format, arrange, and make edits to the above text

Revision as of 18:55, 5 June 2024

Using Flags with EFPSE

EFPSE can be passed a few different flags to the executable. These flags are as follows:

Example Flags

  1. Game.exe -console
    • Command: "C:/../../Desktop/Projects/Game.exe" -console
    • Description: Will launch the game with the console open.
  2. Game.exe -data ProjectName
    • Command: "C:/../../Desktop/Projects/Game.exe" -data ProjectName
    • Description: This one works with Game.exe stored in Projects folder. Works the same as “Test Game” function. Preferred method for testing because manual edits of DAT files aren’t reset.
  3. Game.exe -map number
    • Command: "C:/../../Desktop/Projects/Game.exe" -map 1
    • Description: Launching your game from exact map number, starts from zero. Same as “Test Current Map”.
  4. Multiple Flags
    • Command: "C:/../../Desktop/Projects/Game.exe" -console -data ProjectName -map 1
    • Description: Combining multiple flags in a single command.

How to Use a Flag: Create a Shortcut

The simplest method to use these flags is to create a shortcut. Follow these step-by-step instructions:

Step 1: Create a Basic Shortcut

  1. Right-click on the Desktop: Right-click on any empty space on your desktop.

  2. Select ‘New’ > ‘Shortcut’: From the context menu, choose “New” and then “Shortcut”.

  3. Enter the Path of the Program: A window will appear asking for the location of the item. Enter the full path of the executable file you want to create a shortcut for. For example:

    "C:/../../Desktop/Projects/Game.exe"
  4. Click ‘Next’: After entering the path, click the “Next” button.

  5. Name Your Shortcut: Enter a name for your shortcut, such as “Launch Game with Console”.

  6. Click ‘Finish’: Click the “Finish” button to create the shortcut.

Step 2: Modify the Shortcut to Accept Command-Line Options

  1. Right-click on the Shortcut: Locate the shortcut you just created on the desktop, right-click on it, and select “Properties”.
  2. Edit the ‘Target’ Field: In the “Shortcut” tab, you will see a field labeled “Target”. This field will show the path to your program.
  3. Add Command-Line Options: To pass command-line options, append them to the target path. For example:
    • To open the game with the console:

      "C:/../../Desktop/Projects/Game.exe" -console
    • To test with project data:

      "C:/../../Desktop/Projects/Game.exe" -data ProjectName
    • To start from a specific map:

      "C:/../../Desktop/Projects/Game.exe" -map 1
    • To combine multiple flags:

      "C:/../../Desktop/Projects/Game.exe" -console -data ProjectName -map 1
  4. Save Your Changes: After adding the necessary options, click “Apply” and then “OK” to save your changes.

Step 3: Using Your Shortcut

  1. Double-click the Shortcut: Simply double-click the shortcut to run it with the specified command-line options.
  2. Verify the Behavior: Ensure that the game behaves as expected with the options you provided.

Additional Tips

  • Environment Variables: You can use environment variables in the target path, such as %USERPROFILE%.

  • Quotes: If your paths or options contain spaces, enclose them in double quotes. For example:

    "C:/../../Desktop/Projects/Game.exe" "-data Project Name"
  • Administrative Rights: If the program requires administrative rights, you may need to set the shortcut to run as administrator. In the properties window, go to the “Shortcut” tab, click “Advanced…”, and check “Run as administrator”.

By following these instructions, you can easily create and use a shortcut that passes command-line options to EFPSE in Windows 10 or 11.

Setting up a command for Powershell

Creating custom commands in PowerShell to run specific programs with parameters, like game -data projectName, involves defining functions and adding them to your PowerShell profile. Here’s how you can set this up:

Step-by-Step Instructions

  1. Open PowerShell: Press Win + R, type powershell, and press Enter.

  2. Check for PowerShell Profile: First, check if you have a PowerShell profile file. In PowerShell, type:

    Test-Path $PROFILE

    If it returns True, a profile already exists. If it returns False, create one using:

    New-Item -Path $PROFILE -ItemType File -Force
  3. Open the Profile File: Open the profile file in a text editor to add your custom command. Use:

    notepad $PROFILE
  4. Define Your Custom Command: Add a function to the profile file for your custom command. For example:

    function game {

       param (
    
           [Parameter(ValueFromRemainingArguments=$true)]
    
           [string[]]$args
    
       )
    
       & "C:\Users\SeltT\OneDrive\Desktop\Projects\Game.exe" @args
    

    }

  5. Save and Close: Save the changes and close the text editor.

  6. Reload Profile: Reload the profile to apply the changes. In PowerShell, type:

    . $PROFILE

Using Your Custom Command

Now you can use your custom game command in PowerShell. Here are a few examples:

  • To launch the game with the console:

    game -console
  • To launch the game with a specific project name:

    game -data ProjectName
  • To launch the game from a specific map number:

    game -map 1

Using the multiple flags

  • To launch the game with multiple flags:

    game -console -data -map 1

Disclaimer

AI DISCLAIMER: AI was used to format, arrange, and make edits to the above text