How to create shortcut of exe using R?

x <- c('$SourceFilePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"',
       '$ShortcutPath = "C:/Users/xxxx/Desktop/MsEdge.lnk"',
       '$WScriptObj = New-Object -ComObject ("WScript.Shell")', 
       '$shortcut = $WscriptObj.CreateShortcut($ShortcutPath)',
       '$shortcut.TargetPath = $SourceFilePath',
       '$shortcut.Save()')

for (i in seq_along(x))
system(paste0('powershell -command ', shQuote(x[i])))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.