Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批处理文件(命令行)以获取“中Internet快捷方式(.url)的目标路径;网址:";“下的字段”;网络文件;标签_Batch File_Target_Shortcut - Fatal编程技术网

Batch file 批处理文件(命令行)以获取“中Internet快捷方式(.url)的目标路径;网址:";“下的字段”;网络文件;标签

Batch file 批处理文件(命令行)以获取“中Internet快捷方式(.url)的目标路径;网址:";“下的字段”;网络文件;标签,batch-file,target,shortcut,Batch File,Target,Shortcut,批处理文件(命令行),以在“Web文档”选项卡下的“url:”字段中获取Internet快捷方式(.url)的目标路径 我需要从文件夹(桌面)中的所有快捷方式中获取目标及其各自的目的地,以帮助我的计算机维修店的人员防止客户/客户通过访问这些网站重新感染他们的计算机 我已经有代码要显示(如下),但是当它找到一个目标时,我还需要显示它(一个.url快捷方式文件) 目录/b“%userprofile%\Desktop*.url” -谢谢,-G我想我理解你的问题,这里有一个批处理文件,它将在给定文件夹中

批处理文件(命令行),以在“Web文档”选项卡下的“url:”字段中获取Internet快捷方式(.url)的目标路径

我需要从文件夹(桌面)中的所有快捷方式中获取目标及其各自的目的地,以帮助我的计算机维修店的人员防止客户/客户通过访问这些网站重新感染他们的计算机

我已经有代码要显示(如下),但是当它找到一个目标时,我还需要显示它(一个.url快捷方式文件)

目录/b“%userprofile%\Desktop*.url”


-谢谢,-G

我想我理解你的问题,这里有一个批处理文件,它将在给定文件夹中的链接中循环,然后回显每个目标URL

批处理文件:

echo off
setlocal enableextensions enabledelayedexpansion

pushd %1

for %%F in (%1\*.url) do (
   echo %%~dpnxF
   call :findurl "%%~dpnxF"
)
popd


goto end

:findurl inputfile
set url=
for /f "tokens=2 delims==" %%i in ('findstr URL %1') do set url=%%i
echo %url%
echo -----

:end
用法:

MyBatchFile.bat C:\users\Username\Desktop
预期产出:

[编辑]只是一个关于发生了什么的快速解释,.url文件基本上只是文本文件,在记事本中打开一个即可查看。URL位于URL行上=

此批处理只读取目录中的每个.url文件,然后在“url=”之后回显url行上的所有内容

希望这就是你的意思


Martyn

这种格式也适用

@echo off

Setlocal Enableextensions
Setlocal Enabledelayedexpansion

for /r %%X in (*.url) do (
  set shortcut="%%X"
  echo SHORTCUT: !shortcut!


     for /f "tokens=2 delims==" %%i in ('findstr URL !shortcut!') do (
     set url=%%i
     echo.
     echo URL PATH: !url!
     )

  echo ----------------------------------------------------------------
  echo.
)

:end
@echo off

Setlocal Enableextensions
Setlocal Enabledelayedexpansion

for /r %%X in (*.url) do (
  set shortcut="%%X"
  echo SHORTCUT: !shortcut!


     for /f "tokens=2 delims==" %%i in ('findstr URL !shortcut!') do (
     set url=%%i
     echo.
     echo URL PATH: !url!
     )

  echo ----------------------------------------------------------------
  echo.
)

:end