Skip to content

Instantly share code, notes, and snippets.

@lxfly2000
Last active November 17, 2019 08:54
Show Gist options
  • Save lxfly2000/cba1ca5adfd70e1d928f7248fa7b5053 to your computer and use it in GitHub Desktop.
Save lxfly2000/cba1ca5adfd70e1d928f7248fa7b5053 to your computer and use it in GitHub Desktop.
::下载后请把编码改成ANSI。
@echo off
::设定收藏图片的位置
set fav_dir=D:\Yueyu\图片\收藏
if "%~1"=="" (
call :alert 未指定文件。
goto :eof
)
if not exist "%~1" (
call :alert 这个文件不存在。
goto :eof
)
if not exist "%fav_dir%" md "%fav_dir%"
mklink "%fav_dir%\%~nx1" %1
if %errorlevel%==0 (
explorer/select,"%fav_dir%\%~nx1"
goto :eof
)
echo 这个操作需要管理员权限……
mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~0 ""%~1""","%cd%","runas",1)(close)
goto :eof
:alert
echo %~1
mshta "vbscript:alert("%~1")&close"
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment