Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Assign results of a PowerShell command into a Windows Batch variable

$
0
0

Hi,

I am calling PowerShell from a windows batch file.

In the batch File I have a path with a wildcard and I need to invoke PowerShell to find a particular file where * gets replaced by 2104.

What I currently have is:

SET FILE=C:\test\FIRMS*.ZIP

In variable FILE2, I want to get FIRMS_2014.zip

How can I assign the results of the powershell invocation to File2?

Something like this:

SET FILE2 = PowerShell -command "Get-ChildItem %FILE% "

Which of course does not work.

I have been battling with this and don’t find any reference. Could someone help with this please?

Thanks in advance,

Waldemar


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>