How exactly do you include a line from a text file in a command in cmd
eg
Text File1.txt
notepad
firefox
outlook
So you can execute a command eg start (line number here)
So "start 3" would launch outlook etc
The following batch script reads and echoes the lines from a text file:
for /f "delims=|" %%i in (file1.txt) do @echo %%i
The delims
is necessary if the text lines contain spaces (or anything other than '|'
, or any other arbitrary but rare character you want).
So you could probably modify the script to execute each line as a command:
for /f "delims=|" %%i in (file1.txt) do @start "x" %%i
Note
You need the double %%
if you're executing this command within a batch file, but only single %
if you're executing it directly in a command shell window.
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.