Studio Execute Bat Issue

Hi forum,

Recently I’m facing an issue deleting local files. “Kill Process” Activities took up to 5 mins to delete 4MB files.

That’s y I wrote a bat instead of Kill process Activities. When I execute the bat directly it ran perfectly, but when I execute by UiPath, somehow it only deleted the Data within the Excel instead of delete the whole xlsm file.

The bat code is:
@echo off
chcp utf8
chcp 65001
chcp 936
chcp 437
del C:\Users*.xlsm /f /s /q

The activity to execute the bat file is “Start Process”.

Please Help :rofl:

sorry, It’s “delete” Activity, not kill process :rofl:

@caoshixiao1

Hello Caoshixiao,
please try the following activity to delete multiple files, as I take it from your file name with the asterisk.
Best regards
Stefan

image

Hi StefanSchnell,
Thanks for the reply,

Your code was acatually what I did the first time, but somehow it took 40 mins to delete 100MB file :rofl: That’s the reason I wrote the bat. Any other idea?

1 Like

@caoshixiao1

Hello Caoshixiao,
to start a batch file please try the command cmd with the parameters /C and your batch file name.
Best regards
Stefan

image

Here my batch file:
del C:\Dummy\*.txt

Thanks Ima give it a try

@caoshixiao1

Hello Caoshixiao,
could it be possible that your Excel file is still opened by a process?
Best regards
Stefan

Hi, there are 20 Excel files to delete. If one of the excel was opened, would it affect other files?

@caoshixiao1

Hello Caoshixiao,
when I want to delete an Excel file that is still open, an error message appears.
If I process this in a loop, I would say there will be an exception here as well or waiting until the file is released.
Best regards
Stefan

image

Hi,
The issue I am facing is when the UiPath execute the bat file, it only deletes the data in the Excel, but the file itself is still existing in the local folder. If I mannually execute the bat file is acatually functional.