Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Wert aus Dateinamen in Powershell Script importieren?

$
0
0

Hallo,

gibt es eine Möglichkeit aus einem Dateinamen die Anzahl (hier im Beispiel 7) in das Powershellscript zu integrieren, wenn man das Script ausführt?

Beispiel:  Filename_print_7.pdf

Die Anzahl der Prints (number_of_copies) = 7, welche per LPR Befehle weiterverarbeitet wird. Genau das ist die Problematik. Hat jemand eine Tipp?

Vielen Dank!

param (
    [string]$file = "\\10.11.10.5\usr_at\Scans\temp\*.pdf",
    [int]$number_of_copies = 1
)
foreach ($onefile in (Get-ChildItem $file -File)) {
    for ($i = 1; $i -le $number_of_copies; $i++) {
        cmd /C "lpr -S 10.39.33.204 -P printer ""$($onefile.FullName)"""
    }
   }


Viewing all articles
Browse latest Browse all 2314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>