I’m calling a Batch script from PowerShell with Start-Process, however before Start-Process, I need to match up the variables in both PowerShell and Batch so once I change the path to the file once in PowerShell, it changes in both places (PowerShell and batch at the same time). Let me give an example;
Let’s call the path ‘C:\Documents\Library’, and that path will be fed into a variable. $PathToFile = ‘C:\Documents\Library’
The above path is being called in both places. PowerShell and Batch. Now let’s say that path changes from ‘C:\Documents\Library’ to ‘C:\Library\MyFiles’
Can I change that path in PowerShell, and it also change in batch automatically via the variable $PathToFile ?
I’m not completely sure if I got what you are talking about. But let me ask something to make it more clear. Why do you use batch from Powershell? That should not be necessary at all. Why don’t you continue with Powershell? How do you access variables you set in Powershell in a batch script? It might be helpful to see your actual code.
OK. I got this now. But why do you use a batch script at all? Powershell is much more powerfull (that’s why they choose the name I guess) and IMHO much easier.