Home > Blockchain >  AutoIt to accept file name with space in parameterized test
AutoIt to accept file name with space in parameterized test

Time:11-18

Using AutoIt, when I run the script which has a file without space in between (e.g. filename.txt), the test gets executed successfully, but when a filename has space in between(e.g. : File Name.txt) then I am getting an error ("File not found").

This is the code that I have in Parameterized.au3

ControlFocus("Open","","Edit1")
ControlSetText("Open","","Edit1",$CmdLine[1])
ControlClick("Open","","Button1")

This is the runtime execution

Runtime.getRuntime().exec("C:\\Users\Screenshots\\Parameterized.exe"   " "
                  filePath);

the filePath is passed as an argument from another method which looks something like below

filePath-> "C:\\Temp\\TMP\\TCs\\TC1\\Solution File.txt"

CodePudding user response:

Take your file path into " so that your exec would look like:

Runtime.getRuntime().exec("C:\\Users\Screenshots\\Parameterized.exe"   " "
                  "\""   filePath   "\"");
  • Related