cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Access Denied Error while running Batch File from BP

Rajkumarichoudh
Level 2
I am using below batch script to divide my large text file into multiple files based on the no of lines - 
@Echo Off
Setlocal EnableExtensions DisableDelayedExpansion

Set "inFile=%1%"
Set "nLines=50000"

If Not Exist "%inFile%" GoTo :EOF
For %%A In ("%inFile%") Do Set "fName=%%~nA"&Set "fExt=%%~xA"

Set "count=0"
For /F %%A In ('Find /C /V ""^<"%inFile%"') Do Set "fLines=%%A"

(For /L %%A In (1 1 %fLines%) Do (Set/P "data="
Set/A "file=(count/%nLines%)+1", "count+=1"
SetLocal EnableDelayedExpansion
(Echo=!data!)>>"%fName%_!file!%fExt%"
EndLocal))<"%inFile%"

EndLocal
GoTo :EOF

while running this batch file from cmd i am not getting any error and getting the desired output. But when i run the same from BP start Process action it gives me "access is denied" error. please help me to find the issue. I have attached error image for the reference.
32859.png

------------------------------
Rajkumari choudhary
------------------------------
1 REPLY 1

GopalBhaire
Level 10

Hi Rajkumari,

I think it is trying to create files in Blue Prism directory.  Try changing the directory to file path where you want to save the file in batch file or for file path of batch file use cd %~dp0

Hopefully, this will resolve the issue.



------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------