In another thread there's a discussion of PSHELL's current directory not automatically following TCC's current directory. I experimented with several aliases to get such following to happen and I kept running into the same oddity. I won't use an alias here. Take this command, for example.
As far as I can tell, it works the first two times it's issued in a TCC session. After that, if it's issued again within 20 seconds, it works; if issued again after more than 20 seconds, it fails (as below). Here's what I see in the two scenarios.
I get different, and not very consistent, results if I try to automate my testing, for example, with a DO loop executing the command after various delays.
*pshell /s "%@pshell[set-location '%_cwd'] echo OK"
v:\> *pshell /s "%@pshell[set-location '%_cwd'] echo OK" OK v:\> *pshell /s "%@pshell[set-location '%_cwd'] echo OK" PSHELL: System.Management.Automation.PSInvalidOperationException : The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.