尝试使用.bat文件隐藏.bmp中的文本

时间:2015-10-08 16:47:26

标签: batch-file

我试图编写一个.bat文件,将两个文件复制并合并为一个,然后删除这两个文件。问题是我想让它输入文件位置(通过用户的输入),而不是将它们放在具有特定名称的特定文件夹中。目前这就是我所拥有的:

@echo off
Echo Create two files inside of \secret\, one with text saved as Text.txt and the image as Image.bmp
pause
copy "C:\Users\Drew\Desktop\Secret\Image.bmp" + "C:\Users\Drew\Desktop\Secret\Text.txt" "C:\Users\Drew\Desktop\Secret\final.bmp"
del "C:\Users\Drew\Desktop\Secret\Text.txt" + "C:\Users\Drew\Desktop\Secret\Image.bmp"
echo Finished.
pause
stop

1 个答案:

答案 0 :(得分:1)

要求用户输入,请使用set /p "variable=prompt text"

@echo off
pushd "C:\Users\Drew\Desktop\Secret"
dir /w *.txt 
set /p "text=Give me a Textfile: "
dir /w *.bmp
set /p "Image=Give me an Imagefile: "
set /p "Final=Give me a final Name: "
copy /b "%image%" + "%text%" "%final%"
del "%text%" 
del "%image%"
echo Finished.
pause
popd
rem stop is no cmd command

参考:set /?dir /?pushd /?popd /?