Link to home
Start Free TrialLog in
Avatar of Roccat
RoccatFlag for United States of America

asked on

path with wildcard

How can I use a wildcard in a path name?  Java is always updating and I need to be able to copy files into the java security folder but I dont want to have to keep updating the path name for every version.  How can I use a wildcard for a folder in the path.
The dirtory is C:\Program Files (x86)\Java\jre1.8.0_111\lib\security

Here is what I have tried.
copy-item c:\test.txt "C:\Program Files (x86)\Java\jre*\lib\security"
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roccat

ASKER

Thank you!
Avatar of Roccat

ASKER

In case anyone else is looking to do what I am doing this is it.
Get-ChildItem 'C:\Program Files (x86)\Java\jre*'  -Directory | % {Copy-Item -Path 'local_policy.jar' -Destination "$($_.FullName)\lib\security" -force}
Get-ChildItem 'C:\Program Files (x86)\Java\jre*'  -Directory | % {Copy-Item -Path 'US_export_policy.jar' -Destination "$($_.FullName)\lib\security" -force}