- $p='';
- $process=New-Object System.Diagnostics.Process;
- #$process.StartInfo.WindowStyle=[System.Diagnostics.ProcessWindowStyle]::Hidden;
- $process.StartInfo.UseShellExecute=$false;
- $process.StartInfo.RedirectStandardOutput=$true;
- $process.StartInfo.FileName='E:\Shortcut.exe';
- $process.StartInfo.Arguments='/F:"'+$_+'" /A:Q';
- [void]$process.Start();
- $result=$process.StandardOutput.ReadToEnd();
- $m=[regex]::match($result, 'TargetPath=([^\r\n]+)');
- if($m.Success){$p=$m.groups[1].value;}
- $process.WaitForExit();
- $process.Dispose();
复制代码
|