Solved

path with wildcard

Posted on 2016-11-08
3
28 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

929 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

12 Experts available now in Live!

Get 1:1 Help Now