<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcMap Command Line Arguments in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395291#M10545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The only way I see this working is if you write your own exe that starts ArcMap (by creating the application) and sets the values on the extension after arcmap finished starting.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Oct 2011 17:47:51 GMT</pubDate>
    <dc:creator>AlexanderGray</dc:creator>
    <dc:date>2011-10-04T17:47:51Z</dc:date>
    <item>
      <title>ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395289#M10543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello There,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way in .Net (c#) to get access to command line argument passed to ArcMap on starting the application. I use an extension and I wish to run ArcMap the following way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;"C:\Program Files (x86)\ArcGIS\Desktop10.0\Bin\ArcMap.exe test.xmd param2 param3".&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pascal&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 09:15:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395289#M10543</guid>
      <dc:creator>PascalCoulon</dc:creator>
      <dc:date>2011-10-04T09:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395290#M10544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you want to pass these command line arguments for debugging, then in Visual Studio open the project options and select the Debug tab page, where you will find a "Command line arguments" option.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 17:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395290#M10544</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2011-10-04T17:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395291#M10545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The only way I see this working is if you write your own exe that starts ArcMap (by creating the application) and sets the values on the extension after arcmap finished starting.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 17:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395291#M10545</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-10-04T17:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395292#M10546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see I mis-read the original post and earlier replied with just setting a debugging command line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want access to your own additional arguments passed on ArcMap's command&amp;nbsp; line, then I found &lt;/SPAN&gt;&lt;A href="http://stackoverflow.com/questions/504208/how-to-read-command-line-arguments-of-another-process-in-c" rel="nofollow noopener noreferrer" target="_blank"&gt;something&lt;/A&gt;&lt;SPAN&gt; on StackOverflow that might work for you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

string wmiQuery = string.Format("select CommandLine from Win32_Process where Name='{0}'", "ArcMap.exe");
System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(wmiQuery);
System.Management.ManagementObjectCollection retObjectCollection = searcher.Get();
foreach (System.Management.ManagementObject retObject in retObjectCollection)
&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.WriteLine("&amp;gt;&amp;gt;&amp;gt;&amp;gt;" + retObject["CommandLine"]);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this and can see a map document path and any additional params passed to ArcMap. How reliable this will be, I do not know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that this can be used to get the command-line for any running process.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395292#M10546</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2021-12-11T18:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395293#M10547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After looking into this more, I think this is a better solution than the WMI version I posted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will get the command-line arguments for the current process, which will allow your extension to get ArcMap's:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;string[] args = Environment.GetCommandLineArgs();&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 20:44:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395293#M10547</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2011-10-04T20:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395294#M10548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much for your latest reply. I can confirm that it will work; thought ArcMap expect the path to a valid MXD as the first parameter. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pascal&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 06:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395294#M10548</guid>
      <dc:creator>PascalCoulon</dc:creator>
      <dc:date>2011-10-05T06:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcMap Command Line Arguments</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395295#M10549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks jeff that is useful to me too.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 11:51:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcmap-command-line-arguments/m-p/395295#M10549</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-10-05T11:51:54Z</dc:date>
    </item>
  </channel>
</rss>

