全盘搜索文件名并复制批处理所在目录下的一个文件
发布网友
发布时间:2022-04-25 04:59
我来回答
共1个回答
热心网友
时间:2023-10-27 21:23
/*&cls
@echo off
set @=q&set/an=0x53b7e0b4
title %@%%@% %n%
rem 指定要复制的exe
set "exefile=xxxx.exe"
rem 指定要生成的快捷方式
set "shortcutfile=xxxx.lnk"
cd /d "%~dp0"
echo;Searching……
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:\ (
echo;%%a:\
for /f "delims=" %%b in ('dir /a-d/b/s "%%a:\HPSocket4C.dll" 2^>nul') do (set "dllpath=%%~dpb"&goto :end)
)
)
:end
echo;"%dllpath%"
if exist "%exefile%" (
if defined dllpath (
copy "%exefile%" "%dllpath%" /y
cscript -nologo -e:jscript "%~f0" "%shortcutfile%" "%dllpath%%exefile%"
) else echo;The dll file is Not Found
) else echo;The exe file is Not Existed
pause & exit
*/
var ws=new ActiveXObject('Wscript.Shell');
var shortcutfile=ws.SpecialFolders('Desktop')+'\\'+WSH.Arguments(0);
WSH.echo(shortcutfile);
var shortcut=ws.CreateShortcut(shortcutfile);
shortcut.TargetPath=WSH.Arguments(1);
shortcut.WorkingDirectory=WSH.Arguments(1).replace(/\\[^\\]*$/, '');
shortcut.Save();