waliedassar

UNC Path Bug

Oct 10th, 2016
209
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $dir = "\\localhost\C$\test\"
  2. $exeName = "X.exe"
  3.  
  4.  
  5. echo $dir
  6. echo $exeName
  7.  
  8. for($i=0;$i -le 5; $i++)
  9. {
  10.     $exe = $dir + $exeName
  11.     echo $exe
  12.     $pinfo = New-Object System.Diagnostics.ProcessStartInfo
  13.     $pinfo.WorkingDirectory = $dir
  14.     $pinfo.FileName = $exe
  15.     $pinfo.UseShellExecute = $false
  16.     $p = New-Object System.Diagnostics.Process
  17.     $p.StartInfo = $pinfo
  18.     $p.Start() | Out-Null
  19.     #$p.WaitForExit()
  20.     #$stdout = $p.StandardOutput.ReadToEnd()
  21.     $exeName = "X_" + $i + ".exe"
  22.     rename-item -path $exe -newname $exeName
  23. }
RAW Paste Data