Asked by:
Use * in path variables

Question
-
Hi,
I need to create a script that will copy files from specific folders and run it on a local computer. New updates of softwares are coming every month and I need to create a script that will copy file regardless of the name. If I have file somefile-2-3-0-x86.msi is it possible or how to copy that file by looking only on first 3-4 letters and not the whole file.
Something like this
$file = '\\location of the file\company\IT\filename*'
On this way I don't care about the whole file name, because first letters are always the same. On this way I will not get error when running Invoke-Expresson
- Edited by Quantum5 Thursday, May 23, 2019 10:10 AM
Thursday, May 23, 2019 10:08 AM
All replies
-
Start here: How to ask questions in a technical forum
Please carefully review the following links to set your expectation for posting in technical forums.
This Forum is for Scripting Questions Rather than script requests
Microsoft Virtual Academy - Getting Started with Microsoft PowerShell
\_(ツ)_/
Thursday, May 23, 2019 10:19 AM -
That is not the answer on my question. Can someone please help me?Thursday, May 23, 2019 12:08 PM
-
That is not the answer on my question. Can someone please help me?
We cannot decode what you are asking. What code is it that you have written and what is the error? Please try to ask a good technical question.
Start by reading this: How to ask questions in a technical forum
If you are not a technically trained person then you should be posting in a general user forum.
You are asking about "*" the wildcard. Yes you can use a wildcard in some commands but not others. The exact answer depends on the code you are writing.
Read the link above carefully. Post a clear question and the code you have written.
\_(ツ)_/
Thursday, May 23, 2019 12:27 PM -
If you are just asking for how to use a wildcard then you would just add it to a path.
copy c:\test\* c:\test2
to learn how to use a command use the help:
help copy -online
PS help will tell you where you can use wildcards and how to use a command.
\_(ツ)_/
Thursday, May 23, 2019 12:30 PM