Computer Hope
Microsoft => Microsoft DOS => Topic started by: How do I open two files? on May 11, 2004, 04:13:07 PM
-
Okay, i'm making a bat file and I need to open two .txt files at once inside windows XP, is there an arguement that I can pass such as Bash's '&' character? Thanks for any help. Also, below is my batchfile, any suggestions for additions would be appriciated. Specifically, i'm trying to open pid.txt and netstat.txt at the same time so the user can compair the files and find out which program is involved with which PID.
@echo off
title Net Diagnostic
cls
echo Running.....
echo }---------------------------------------IPConfig----------------------------------------------{ > "%windir%\netstat.txt"
echo ....ipconfig
ipconfig >> "%windir%\netstat.txt"
echo. >> "%windir%\netstat.txt"
echo }----------------------------------------Netstat-----------------------------------------------{ >> "%windir%\netstat.txt"
echo ....netstat -ano
netstat -ano >> "%windir%\netstat.txt"
echo. >> "%windir%\netstat.txt"
echo ------DONE!------
echo This window will close when
echo you close the txt file. Please
echo do not manually close this
echo window as it has several
echo other functions to perform.
echo. >> "%windir%\netstat.txt"
echo }--------------------------------------------------------------------------------------------------{ >> "%windir%\netstat.txt"
echo }----------------------------------------PID-List-----------------------------------------------{ > "%windir%\pid.txt"
tasklist >> "%windir%\pid.txt"
"%windir%\netstat.txt" %
"%windir%\pid.txt"
del "%windir%\pid.txt"
del "%windir%\netstat.txt"
cls
exit
-
this may seem a bit primitive but i think it will solve your problem
i just tried it on my win98 platform
i have two txt files, file1.txt and file2.txt
i use the echo command to create the bat by using two >
here is how
echo notepad file1.txt >> showtwo.bat
then
echo notepad file2.txt >> showtwo.bat
your batch file will now look like
notepad file1.txt
notepad file2.txt
then just type and enter showtwo
and you will get both files to open in notepad
-
I use Rogsoft Notepad+ and can simply open two TXTs in the Notepad+ session on my Win98 box. (Notepad+ is a freeware replacement for Windows Notepad on Win9x machines).
-
not so primitive if you want your user to be allowed two input files, say input1.txt and input2.txt
make a batch file with the following two lines
notepad %1.txt
notepad %2.txt
name the batchfile open2.bat
then say the user wants to open mildew.txt and yooo.txt
the use simply types
open2 mildew yooo
(mind the spacing)