问题
I know the title doesn't make sense, but I have one question. I have made this file called Test.bin and here's whats inside the .bin file:
echo Hello World
Since its a test file, I've been trying to see if i can make a batch file that can read the commands in the .bin file and output it onto the console.
回答1:
Not sure what you are trying to do exactly, but I think you have two options:
Rename test.bin as test.bat and run it with:
test
Start a new command interpreter and send it your commands:
cmd < test.bin
回答2:
You could also use the copy command. However, for this to work the test.bin file should be in the same directory/folder. Alternatively, you can specify the file's path.
Your code should look something like this:
@echo off
copy test.bin
Or, using the filepath method (pretending its on your desktop):
@echo off
copy C:/users/me/Desktop/test.bin
来源:https://stackoverflow.com/questions/23860361/batch-file-reading-and-activate-commands-from-unknown-files