Solved

path with wildcard

Posted on 2016-11-08
3
20 Views
Last Modified: 2016-11-08
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"
0
Comment
Question by:Roccat
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 41878898
In test mode; remove the -WhatIf at the end to run it for real:
Get-ChildItem 'C:\Program Files (x86)\Java\jre*' -Directory | % {Copy-Item -Path 'C:\test.txt' -Destination "$($_.FullName)\lib\security" -WhatIf}

Open in new window

1
 

Author Closing Comment

by:Roccat
ID: 41878920
Thank you!
0
 

Author Comment

by:Roccat
ID: 41878935
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}
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Synchronize a new Active Directory domain with an existing Office 365 tenant
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now