Teensy 键盘控制打开CMD并ping baidu.com

int count = 0;
void setup() { } // no setup needed
void loop() {
  delay(1000);
  //Keyboard.print("HI,I am Tony!"); 
  delay(1000);
  RunPro("cmd");
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  RSTkey(); 
  CloseInputMethod();
  delay(1000); 
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  Keyboard.print("ping baidu.com");
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();

  RSTkey();
 
  delay(5000000);
}
void RSTkey(){
   //release key 
  Keyboard.set_modifier(0);//release ctrl or shift etc.
  Keyboard.set_key1(0);//release normal key
  Keyboard.send_now();
  //release key ok
}
void Count(){
  count = count + 1;
}
void RunPro(String ProName){
  Keyboard.set_modifier(MODIFIERKEY_GUI);
  Keyboard.set_key1(KEY_R);
  Keyboard.send_now();
  RSTkey();
  delay(100);
  CloseInputMethod();
  Keyboard.print(ProName);
  delay(30);
  Keyboard.set_key1(KEY_ENTER);
  Keyboard.send_now();
  RSTkey();
  delay(1000);
}
void CloseInputMethod(){
  Keyboard.set_modifier(MODIFIERKEY_CTRL);
  Keyboard.send_now();
  Keyboard.set_key1(KEY_SPACE);
  Keyboard.send_now();
  RSTkey();
  delay(1000);
  Keyboard.set_modifier(MODIFIERKEY_SHIFT);
  Keyboard.send_now();
  RSTkey();
  delay(100);
}