Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Multiple Files in Vista MS DOS

Status
Not open for further replies.

dick606

Technical User
Mar 15, 2009
9
0
0
US
Here is my batch file:
Code:
Q:
cd DIRECTORY
"FILE 1"
"FILE 2"
"FILE 3"
"FILE 4"
"FILE 5"
"FILE 5"
"FILE 5"
"FILE 6"

i AM GETTING the first file to open in excel, but the rest of them will not open. It will freeze on the first one, and not open the next one in the list until I close excel first. Am I missing something simple? Like PAUSE, maybe? What I want to do is open multiple files in one instance of Excel using this batch file.

On the other hand, this works:
Code:
Q:
cd DIRECTORY
start excel.exe
start "FILE 1"
start "FILE 2"
start "FILE 3"
start "FILE 4"
start "FILE 5"
start "FILE 5"
start "FILE 5"
start "FILE 6"
However, I do NOT want 6 instances of excel running! what a pain! =) Can anyone help me open 6 different files in excel from a batch file with only one instance of excel running? Thanks so much!
 
You can do this:
Code:
Q:
cd DIRECTORY
start excel.exe "FILE 1" "FILE 2" "FILE 3" "FILE 4" ....

However, how are you defining 'multiple instances' of excel? Depending on which version you're using, it might not be as it it appears. Using the method posted here, I just tested using Excel 2007 to open 3 files at the same time. On my taskbar, I saw three different icons (as if they were different instances of excel); however, when I resized the individual workbooks, they were all visible in the same excel window. So it was the same instance, despite how it appears on the taskbar. I believe that this behavior will be different depending on the version of excel being used.
 
I think this has something to do with me having multiple versions of excel on my machine. This will work for me:
Code:
q:
cd DIR
start excel.exe "file1" "file2"
But get this...ONLY IN THE DOS PROMPT. If I write the same thing in the text editor and save it as a BAT file, only the first file will open! lol
 
Interesting. somehow, it seems to a limitation of the start command. Try it without starting a seperate process. Alternatively, use the original batch to start another batch that doesn't use 'start'.

I susupect that it's related to how 'start' is interpreting/passing the filename parameters.
 
The help file for start in vista dos gives this.
One would assume /B would do what you want

I created a batch file to open two file they open in one version of excel but you need to close one sheet to get to the next file.I did not actually have to add the /B option it opens one version of excel with two workbooks.

My batch file was similar the files where on my G drive in a folder called test

g:
cd test
start excel.exe "name_of first_file" "name_of_second_file"

When you saved it as a batch file you did change to file type all files and call the file whatever_you_want.bat

(windows vista help for start command)
START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program]
[parameters]

"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top