Solved

path with wildcard

Posted on 2016-11-08
3
50 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

617 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