Open a command prompt and run ipconfig

This example is for an Arduino with HID capabilities. I used a Leonardo

In this example we simply launch a command prompt and run ipconfig /all. The example is fairly simple and just demonstrates sending keystrokes

 

Code

[codesyntax lang=”cpp”]

#include <Keyboard.h> 

// Init function
void setup()
{
  // Begining the stream
  Keyboard.begin();
  // Waiting 500ms for init
  delay(500);
  delay(3000);
  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press(114);
  Keyboard.releaseAll();
  delay(500);
  Keyboard.print("cmd");
  typeKey(KEY_RETURN);
  delay(750);
  Keyboard.print("ipconfig /all");
  typeKey(KEY_RETURN);
}

void typeKey(int key)
{
  Keyboard.press(key);
  delay(50);
  Keyboard.release(key);
}

// Unused
void loop() {}

[/codesyntax]

Related posts

Open Youtube on a PC using a Leonardo

Arduino rubber duck example – hello world