-1
String cmc = "D:\\fileFolder\\File Name-" + CurrentDate() + ".xlsx";

String autoitexec = "D:\\AutoITScripts\\AttachFile.exe" + cmc;

Runtime.getRuntime().exec(autoitexec);

Above code is my current code. I am passing autoIt script location and file location from string autoitexec. I am unable to run above code ..

TT.
  • 15,774
  • 6
  • 47
  • 88
Nagadeep
  • 1
  • 1

1 Answers1

0
String cmc = "D:\\fileFolder\\File Name-" + CurrentDate() + ".xlsx";

String autoitexec = "\"D:\\AutoITScripts\\AttachFile.exe\" \"" + cmc + "\"";

Runtime.getRuntime().exec(autoitexec);

Escape double quotes with a backslash. i.e. 2 double quotes inside a double quoted string is " \" \" ".

Spaces are required between the command and each of the arguments.

michael_heath
  • 5,262
  • 2
  • 12
  • 22