【发布时间】:2016-10-24 19:06:15
【问题描述】:
我正在编写一个非常基本的批处理脚本来运行 MD5 哈希。我需要它向用户询问输出目录,然后询问 IP 地址输出,然后将驱动器号映射到此输出。我可以让它问,但它不会将文件输出到所选目录。它将它放在运行脚本的本地目录中。它也不会将驱动器号映射到它。
@ECHO OFF
pause
REM This section prompts user for output location
:start
CLS
set /p direct="Enter the directory output location: "
dir %1 %direct% > investigation.txt
pause
REM This section prompts user for IP output location
set /p direct="Enter the IP output location: "
dir %1 > investigation.txt
pause
REM Map share
@echo Map Share
@echo off
net use z:
\\%1
pause
编辑
MD5 哈希值将写入 txt 文件。 谁能解释如何将其输出到用户输入的目录以及如何将驱动器号映射到该位置?
【问题讨论】:
-
您似乎对
%1的用途感到困惑。是调用时传递给批处理文件的参数。 -
为什么会有php标签?
-
…什么信息应该输出到investigation.txt
-
您可能需要考虑为您的
set /p输入命令使用不同的变量名。
标签: php batch-file scripting