Create shortcut on Desktop.
Esse commit está contido em:
@@ -1,18 +1,24 @@
|
|||||||
path = require 'path'
|
path = require 'path'
|
||||||
|
|
||||||
module.exports = (grunt) ->
|
module.exports = (grunt) ->
|
||||||
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
{cp, mkdir, rm, spawn} = require('./task-helpers')(grunt)
|
||||||
|
|
||||||
grunt.registerTask 'install', 'Install the built application', ->
|
grunt.registerTask 'install', 'Install the built application', ->
|
||||||
installDir = grunt.config.get('atom.installDir')
|
installDir = grunt.config.get('atom.installDir')
|
||||||
shellAppDir = grunt.config.get('atom.shellAppDir')
|
shellAppDir = grunt.config.get('atom.shellAppDir')
|
||||||
if process.platform is 'win32'
|
if process.platform is 'win32'
|
||||||
|
done = @async()
|
||||||
|
|
||||||
runas = require 'runas'
|
runas = require 'runas'
|
||||||
copyFolder = path.resolve 'script', 'copy-folder.cmd'
|
copyFolder = path.resolve 'script', 'copy-folder.cmd'
|
||||||
# cmd /c ""script" "source" "destination""
|
# cmd /c ""script" "source" "destination""
|
||||||
arg = "/c \"\"#{copyFolder}\" \"#{shellAppDir}\" \"#{installDir}\"\""
|
arg = "/c \"\"#{copyFolder}\" \"#{shellAppDir}\" \"#{installDir}\"\""
|
||||||
if runas('cmd', [arg], hide: true) isnt 0
|
if runas('cmd', [arg], hide: true) isnt 0
|
||||||
throw new Error("Failed to copy #{shellAppDir} to #{installDir}")
|
done("Failed to copy #{shellAppDir} to #{installDir}")
|
||||||
|
|
||||||
|
createShortcut = path.resolve 'script', 'create-shortcut.cmd'
|
||||||
|
args = ['/c', createShortcut, path.join(installDir, 'atom.exe'), 'Atom']
|
||||||
|
spawn {cmd: 'cmd', args}, done
|
||||||
else
|
else
|
||||||
rm installDir
|
rm installDir
|
||||||
mkdir path.dirname(installDir)
|
mkdir path.dirname(installDir)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set USAGE="Usage: %0 source destination"
|
set USAGE=Usage: %0 source destination
|
||||||
|
|
||||||
if [%1] == [] (
|
if [%1] == [] (
|
||||||
echo %USAGE%
|
echo %USAGE%
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set USAGE=Usage: %0 source name-on-desktop
|
||||||
|
|
||||||
|
if [%1] == [] (
|
||||||
|
echo %USAGE%
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
if [%2] == [] (
|
||||||
|
echo %USAGE%
|
||||||
|
exit 2
|
||||||
|
)
|
||||||
|
|
||||||
|
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
|
||||||
|
|
||||||
|
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
|
||||||
|
echo sLinkFile = "%USERPROFILE%\Desktop\%2.lnk" >> %SCRIPT%
|
||||||
|
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
|
||||||
|
echo oLink.TargetPath = %1 >> %SCRIPT%
|
||||||
|
echo oLink.Save >> %SCRIPT%
|
||||||
|
|
||||||
|
cscript /nologo %SCRIPT%
|
||||||
|
del %SCRIPT%
|
||||||
Referência em uma Nova Issue
Bloquear um usuário