Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement the Desktop Shortcut creation tool for batch cmd

Shulou Source: shulou.com Published: 2022-06-03 07:56:14 10月03日 Update

This article mainly explains "how to achieve batch cmd desktop shortcut creation tool," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "how to achieve batch cmd desktop shortcut creation tool" bar!

The core code is as follows

@echo offtitle Desktop shortcut creation tool!> nul 2>&1 REG.exe query "HKU\S-1-5-19" || ( ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs" ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs" "%TEMP%\Getadmin.vbs" DEL /f /q "%TEMP%\Getadmin.vbs" 2>nul Exit /b)set jb51name=Ditto3.lnkset jb51path=%~dp0set jb51exec=%~dp0Ditto.exemshta _VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\%jb51name%""):b.TargetPath=""%jb51exec%"":b.WorkingDirectory=""%jb51path%"":b.Save:close")

parameter description

>nul 2>&1 REG.exe query "HKU\S-1-5-19" || ( ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs" ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs" "%TEMP%\Getadmin.vbs" DEL /f /q "%TEMP%\Getadmin.vbs" 2>nul Exit /b)

The above paragraph is administrator privileges to run itself

set jb51name=Ditto3.lnk

set jb51path=%~dp0

set jb51exec=%~dp0Ditto.exe

jb51name stands for shortcut name

jb51path is path

jb51 exec is the path to the completed exe file, usually with the suffix exe.

In addition, %~dp0 in bat indicates the current directory.

in fact, it is to pass the reference for vbs through bat.

path

The renderings are as follows

Today, Xiaobian also sorted out a little knowledge test without problems.

Later, you can modify the document according to your own requirements.

The following is the code for deleting shortcuts.

Remove Desktop Shortcuts.bat

@echo offtitle Desktop Shortcuts Removal Tool!> nul 2>&1 REG.exe query "HKU\S-1-5-19" || ( ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs" ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs" "%TEMP%\Getadmin.vbs" DEL /f /q "%TEMP%\Getadmin.vbs" 2>nul Exit /b)ping -n 2 127.1>nuldel /f /q "%userprofile%"\Desktop\"Ditto.lnk"del /f /q "%userprofile%"\Desktop\"Ditto.lnk"exit Here, I believe that everyone has a deeper understanding of "How to realize batch cmd desktop shortcut creation tool", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Methods desktops tools paths code content files learning practicality deeper representation interests parameters names suffixes practicality that is simple operation effect Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology OPPO Reno MariaDB Linux Shulou Tech Info