Running a cmd script

Dave Burns
July 28, 2016 16:49 ANSWERED
Hi

Is there anyway to run a small .cmd script, I have tried Start process but it doesn’t find it.

Thanks

1 Like

Lavinia Cojocaru July 30, 2016 01:11 Official comment
It should work with Start Process if you set the whole path for the batch file.
What error does it say?

Dave Burns August 01, 2016 11:36
Hi Lavinia

It doesn’t error, it just doesn’t run the cmd file.

The log file does not show any errors, its a simple process of downloading a csv file from a web site then I have a cmd script that renames the file to a set name, the script works fine if you run it outside of UIPathThanks

Dave Burns August 02, 2016 18:09
I have created a work around, I start a cmd using the start process and then type into to run the file.

Thanks

Andrzej.Kniola August 08, 2016 11:56
Hi Dave,

You should be also able to run it from the Start Process directly:

Process: C:\windows\system32\cmd.exe (or whenever you have it, depending on your win version)

Arguments: “/C C:\Users\kminion\Downloads\renfile.cmd”

Note: you can use /K instead of /C if you want the console to stay open (probably not, but nice to know).

Regards,

Andrzej

4 Likes

Dave Burns August 08, 2016 16:03
Hi Andrzej

I had tried a similar thing but I tried it with your auguments and it still didnt work, no errors just didnt work.

The content of the cmd file is

@echo off & setlocal EnableDelayedExpansion

set a=accounts
for /f “delims=” %%i in (‘dir /b *.csv’) do (
ren “%%i” “!a!.csv”
set /a a+=1
)

and this works fine run interactivly

Thanks

Dave

Dave Burns August 08, 2016 16:14
its because its looking only in the folder that the workflow executes from, if I put the workflow in the downloads folder it renames the file.

Dave