Drew Opland-Evers
Drew Opland-Evers

Reputation: 11

Attempting to hide text in a .bmp with a .bat file

I'm trying to write a .bat file that copies and combines two files into one, then deletes both files. The problem is I want to make it so that you enter the file locations (Via input from the user) instead of putting them in a specific folder with a specific name. Currently this is what I have:

@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

Upvotes: 0

Views: 212

Answers (1)

Stephan
Stephan

Reputation: 56180

to ask the user for Input, use 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

Reference: set /?, dir /?, pushd /?, popd /?

Upvotes: 1

Related Questions