简体   繁体   中英

How to execute cmd command from text file?

正如标题所说,我需要从文本文件中执行cmd命令。让我说我有一个名为file文本文件,在其中它写成了Color A我需要类似命令: type file.txt而不只是在屏幕上写,但我希望它同时按下输入。欢迎批量文件选项。谢谢。

You can use save your normal file with batch programming in it with .bat extension. And run that file WhateverNameItIs.bat on your command prompt.

Saved it as file.bat

 @ECHO ON
 ECHO Color A

In your case you can drag file from your where your are to command prompt. Or Using CD you can reach out where your file is saved within your command prompt. Fire up file.bat on your command prompt will execute whatever batch programming is written on that file.

you can use

xcopy Name.txt (your Folder)
ren Name.txt Name.bat
call Name.bat (or full location of Name.bat)

it should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM