# Is it possible to open a file with processing sketch? (command line)

**URL:** https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613
**Category:** Coding Questions
**Created:** [December 30, 2020, 8:16am UTC](https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613 "2020-12-30T08:16:49Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 4, 2021, 3:24pm UTC](https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613/9 "2021-01-04T15:24:50Z")

</div>

new version

```auto
//https://forum.processing.org/two/discussion/23999/detect-command-line-invocation-of-a-sketch

/**
 * CommandLineDetect
 * 2017-09-21 Jeremy Douglass - Processing 3.3.6 
 * 
 * Related forum discussions:
 * - forum.processing.org/two/discussion/23999/detect-command-line-invocation-of-a-sketch
 * - forum.processing.org/two/discussion/23924/handling-command-line-arguments-in-a-sketch
 * - forum.processing.org/two/discussion/6457/how-to-use-arguments-with-an-application-built-with-processing
 */

// Some editing by GLV & Chrisir. See original (above) for the complete version.

color setBack = 0;
String str1;

void setup() {

  size (770, 770); 

  // Local command-line arguments for testing:  
  // String [] args = {"external", "foo", "bar=baz", "lorem=ipsum dolor sit amet, consectetur adipiscing elit", "etc"};

  if (args == null) {
    println("args is null"); 
    str1 = "no args / internal";
  } else {
    printArray(args); 
    str1 = args[0];
  }//else
}//func 

void draw() {
  background(setBack);
  text( str1, 20, 20 );
}
//

```

keywords: command line, cmd, cmdline, args, arguments, starting, start of Sketch, environment

---

_[View the full topic](https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613)._
