• 【批处理】创建快捷方式


    方法1
    @echo off
    set "exe=%~dp0proe.exe"
    set "name=新创建的快捷方式"
    set m="%ALLUSERSPROFILE%\桌面\%name%.url"
    echo [InternetShortcut]>%m%
    echo URL="%exe%">>%m%
    echo IconIndex=0>>%m%
    echo IconFile=%name%>>%m%

    方法2
    @echo off
    echo Path=%~dp0>test.txt
    echo Overwrite=^2>>test.txt
    echo Shortcut=D, "proe.exe", "\", "快捷方式描述", "快捷方式 proe.exe">>test.txt
    start /wait winrar.exe a -r -ep1 -m1 -sfx -ztest.txt test.exe "proe.exe"
    test.exe /s
    del test.*

    方法3
    @echo off
    if exist tmp.vbs del tmp.vbs /q
    >tmp.vbs echo Set WS=WScript.CreateObject("WScript.Shell")
    >>tmp.vbs echo Set Shortcut=WS.CreateShortCut("%ALLUSERSPROFILE%\桌面\proe.exe.lnk")
    >>tmp.vbs echo Shortcut.TargetPath=WS.CurrentDirectory^&"\proe.exe"
    >>tmp.vbs echo Shortcut.WorkingDirectory = "%~dp0"
    >>tmp.vbs echo Shortcut.Save
    "%SystemRoot%\System32\CScript.exe" //nologo tmp.vbs &&del tmp.vbs

    补充(你增加点东西使得快捷方式的起始位置改成“D:\”)
    @echo off
    if exist tmp.vbs del tmp.vbs /q
    >tmp.vbs echo Set WS=WScript.CreateObject("WScript.Shell")
    >>tmp.vbs echo Set Shortcut=WS.CreateShortCut("%ALLUSERSPROFILE%\桌面\proe.exe.lnk")
    >>tmp.vbs echo Shortcut.TargetPath=WS.CurrentDirectory^&"\proe.exe"
    >>tmp.vbs echo Shortcut.WorkingDirectory = D:\"
    >>tmp.vbs echo Shortcut.Save
    "%SystemRoot%\System32\CScript.exe" //nologo tmp.vbs &&del tmp.vbs

    作者:行走的贝壳

    来源贝壳笔记 (http://ronli.cnblogs.com)

  • 相关阅读:
    Java面向对象
    Java方法
    Java控制语句
    Java接收用户键盘输入
    Java运算符
    Java类型转换
    Java的加载与执行
    Java关键字
    Java常见的DOS命令及JDK
    nginx学习要点记录
  • 原文地址:https://www.cnblogs.com/ronli/p/2382378.html
Copyright © 2020-2023  润新知