以下脚本按预期工作:
echo off
REM This script is designed to demonstrate capture of volatile data from a Post Windows XP client
date /T > c:/Users/Jon/Desktop/file.txt
time /T >> c:/Users/Jon/Desktop/file.txt
getmac >> c:/Users/Jon/Desktop/file.txt
hostname >> c:/Users/Jon/Desktop/file.txt
ipconfig /all >> c:/Users/Jon/Desktop/file.txt
arp -a >> c:/Users/Jon/Desktop/file.txt
ipconfig /displaydns >> c:/Users/Jon/Desktop/file.txt
netstat -an >> c:/Users/Jon/Desktop/file.txt
但是,当为输出文件的位置添加用户输入时:
echo off
REM This script is designed to demonstrate capture of volatile data from a Post Windows XP client
set /p path="Enter Drive Letter "
date /T > %path%:file.txt
time /T >> %path%:file.txt
getmac >> %path%:file.txt
hostname >> %path%:file.txt
ipconfig /all >> %path%:file.txt
arp -a >> %path%:file.txt
ipconfig /displaydns >> %path%:file.txt
netstat -an >> %path%:file.txt
返回一个错误,即除了按预期导出到%path%:file.txt 中的日期和时间之外,这些命令都不是有效的命令
请给我一些解决这个问题的建议好吗?
非常感谢
Jon
path
变量用于枚举要搜索可执行文件的文件夹。如果您覆盖它,则只有内部命令可用(除非您在调用中包含完整路径)
要解决这个问题,只需使用不同的变量名。