在批处理文件中创建备用数据流 运行

Create an alternate data stream mid batch file run

我正在尝试在批处理脚本中创建一个文件,并为同一文件创建一个 ADS(备用数据流),脚本如下所示:

@echo off


echo. 2>notSecret.txt

echo. 2>notSecret.txt:secret

@echo this is not a secret file... or is it :O > notSecret.txt

@echo this is the secret part! > notSecret.txt:secret
@echo great work >>notSecret.txt:secret
@echo you found it >> notSecret.txt:secret

文件已创建,但 ADS 尚未创建。

我们需要向 ADS 回显添加 .txt 文件扩展名

@echo off

echo this is not a secret file... or is it :O > notSecret.txt

echo this is the secret part! > notSecret.txt:Secret.txt