I agree with Wolfgang that taking PowerShell out of the equation would be preferable. I cobbled together this piece of code to grab a list of TXT files and rename them to include a counter. Its not pretty... but it works.
:SET &HND# = PREP_PROCESS_FILENAME("&$AGENT#","\\t11946\Public\UC4_Util_Testing\file*.txt","Y",,,,"UC_LOGIN=LOGIN.UC4")
:set &MyCounter# = 0
:PROCESS &HND#
: SET &LINE# = GET_PROCESS_LINE(&HND#)
: PRINT &LINE#
: set &MyCounter# = &MyCounter# + 1
: set &MyCounter# = substr(&MyCounter#,12)
: set &pos1# = str_find(&Line#,".txt")
: set &pos1# = &pos1# - 1
: set &REPL# = substr(&LINE#,1,&pos1#)
: set &pos1# = str_find_reverse(&REPL#,"\")
: set &pos1# = &pos1# + 1
: set &REPL# = substr(&REPL#,&pos1#)
: set &REPL# = "&REPL#_&MyCounter#.txt"
: print &REPL#
ren "&LINE#" "&REPL#"
@set retcode=%errorlevel%
@if NOT %ERRORLEVEL% == 0 goto :retcode
:ENDPROCESS