回复 2# Batcher
单独运行没有问题,但是合起来又不行了,我前面紧跟的是一个调用vbs创建快捷方式- @echo off
- set "FileName=ABC.exe"
- echo 正在搜索,请稍后...
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\ (
- pushd %%a:\
- for /r %%b in (*%FileName%) do (
- if /i "%%~nxb" equ "%FileName%" (
- echo,%%b
- set way=%%b
- goto :deal
- )
- )
- popd
- )
- )
- :deal
- @echo off
- ::设置程序或文件的完整路径(必选)
- set Program=%way%
- ::设置快捷方式名称(必选)
- set LnkName=ABC
- ::设置程序的工作路径,一般为程序主目录,此项若留空,脚本将自行分析路径
- set WorkDir=
- ::设置快捷方式显示的说明(可选)
- set Desc=steamcommunity_302.exe
- if not defined WorkDir call:GetWorkDir "%Program%"
- (echo Set WshShell=CreateObject("WScript.Shell"^)
- echo strDesKtop=WshShell.SpecialFolders("DesKtop"^)
- echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^)
- echo oShellLink.TargetPath="%Program%"
- echo oShellLink.WorkingDirectory="%WorkDir%"
- echo oShellLink.WindowStyle=1
- echo oShellLink.Description="%Desc%"
- echo oShellLink.Save)>makelnk.vbs
- echo 桌面快捷方式创建成功!
- makelnk.vbs
- del /f /q makelnk.vbs
- goto :open
-
- :none
- goto :eof
- :GetWorkDir
- set WorkDir=%~dp1
- set WorkDir=%WorkDir:~,-1%
- goto :eof
-
- :open
- if exist "%USERPROFILE%\desktop\ABC.lnk" (
- xcopy /y /c /h /r "%USERPROFILE%\desktop\ABC.lnk" "%~dp0"
- del /q /f "%userprofile%\desktop\ABC.lnk"
- start "" "%~dp0ABC.lnk"
- ) else (
- echo 失败
- )
复制代码
|