Batch file for sql command

How i run my sql command using batch file and print output of sql command in text file.

Hi
–we can use EXECUTE QUERY activity and mention the query like select statement which will give us output of type datatable named dt
to get execute query activity go to design tab → manage packages → in official tab search as uipath.database.activities and install it

–now use a GENERATE DATATABLE ACTIVITY and pass the above variable dt as input and get the output with a variable of type string named str_output
–now use a WRITE TEXT FILE activity and pass the variable str_output as input and mention the file path of .txt file

–now use a .bat file and mention the file path of uipathrobot.exe and this project xaml filepath
like this
"C:\Users\example\AppData\Local\UiPath\app-18.1.4\UiRobot.exe” /file “C:\Users\example\Documents\UiPath\Practice\Main.xaml File”

this will run the sql query and store the output of that sql statement to a txt file

Cheers @Gauri_Rawool

can you please share your workflow it will helps us alot.

Thanks

@Palaniyappan how to mention the path of robot and Xaml file in batch file.

1 Like

like this buddy
the first path is the filepath of uirobot.exe and second is the main.xaml file path
but the filepath might differ in your system for both UiPath.exe file and the xaml file. kindly mention as per your machine

Cheers @Gauri_Rawool

1 Like

@Gauri_Rawool

Please use like this:

Hope it will work!!!
Cheers @Gauri_Rawool

1 Like

which activity we have to take for executing bat file.

1 Like

START PROCESS activity where pass the filepath of .bat file as input to FILENAME property of start process activity

Cheers @Gauri_Rawool

1 Like

@Palaniyappan This will work!!

Else you may also use invoke code activity

Process.Start(pathToBatchFile as String)

Cheers @Gauri_Rawool

1 Like

Batch file window popups again and again and also not getting output