Windows 批处理脚本 - 用于使用命令输出 [英] Windows batch script - for using command output

查看:46
本文介绍了Windows 批处理脚本 - 用于使用命令输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个脚本来列出一个 nfs 目录,因此我需要在特定文件夹中映射驱动程序.

I need to create an script that will list a nfs directory and with this result i need to mapdrivers in specific folder.

示例:

C:\ dir /b \\172.16.30.6\myshare
folder1
folder2
folder3
folder4
folder5
.
.
.

返回上面的代码后,我需要为每个文件夹创建一个 for 返回以创建 mklink 文件夹

With return of code above, i need to create an for with each folder return to create mklink folder

for /l %%i in (command?) do (
mklink /d "C:\Share\%%i
)

继续,我需要创建一个脚本来捕获远程目录输出并创建指向每个文件夹的 mklink

Resuming, i need to create an script that will catch remote dir output and create mklink to each folder

有人知道这样做吗?

谢谢!

推荐答案

带有/D 选项的 FOR 命令枚举目录.

The FOR command with the /D option enumerates directories.

for /D %%G IN ("\\172.16.30.6\myshare\*") do mklink /D "C:\share\%%~nxG" "%%~G"

这篇关于Windows 批处理脚本 - 用于使用命令输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆