2017-01-27 3 views
0

UPnP 장치에 대한 바탕 화면 바로 가기를 만드는 powershell 스크립트를 만들려고합니다. 성공적으로 $ WScriptShell.CreateShortcut()을 사용하여 .exe 파일이나 http 주소에 대한 바로 가기를 만들었지 만 장치의 주소를 지정하는 방법을 모르겠습니다. 그러나 Windows 탐색기에서 장치를 마우스 오른쪽 단추로 클릭하여 수동으로 바로 가기를 만들 수 있지만 프로그래밍 방식으로 어떻게합니까? PS와 사용자 정의 바로 가기의Powershell, UPnP 장치의 바로 가기

답변

0

창조 : 제거 USB에 대한 예

# Quick shortcut creation script 

# This if the variable that will hold the computer name of your target device 
$computer = "The Computer Name" 
# This command will create the shortcut object 
$WshShell = New-Object -ComObject WScript.Shell 
# This is where the shortcut will be created 
$Shortcut = $WshShell.CreateShortcut("\\$computer\C$\Users\Public\Desktop\SuperAwesomeness.lnk") 
# This is the program the shortcut will open 
$Shortcut.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe" 
# This is the icon location that the shortcut will use 
$Shortcut.IconLocation = "C:\AwesomeIcon.ico,0" 
# This is any extra parameters that the shortcut may have. For example, opening to a google.com when internet explorer opens 
$Shortcut.Arguments = "google.com" 
# This command will save all the modifications to the newly created shortcut. 
$Shortcut.Save() 

대체 : 여기

$AppLocation = "C:\Windows\System32\rundll32.exe" 
$WshShell = New-Object -ComObject WScript.Shell 
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\USB Hardware.lnk") 
$Shortcut.TargetPath = $AppLocation 
$Shortcut.Arguments ="shell32.dll,Control_RunDLL hotplug.dll" 
$Shortcut.IconLocation = "hotplug.dll,0" 
$Shortcut.Description ="Device Removal" 
$Shortcut.WorkingDirectory ="C:\Windows\System32" 
$Shortcut.Save() 

는 참조에 대한 링크입니다 : 당신을 위해 Custom Shortcut with PS

+0

감사 대답하지만, 파일이나 웹 페이지에 대한 간단한 바로 가기를 만드는 방법을 이미 알고 있습니다. 내 주요 문제는 네트워크 장치에 대한 경로를 지정하는 것입니다. 제 경우에는 웹캠에 대한 바로 가기가 필요합니다. 카메라가 Windows에서 발견되고 네트워크/기타 장치/카메라 아래에 나열됩니다. UPnP를 사용하여 자신을 UUID로 식별합니다 : Upnp-BasicDevice-1_0- . – MathiasS