Windows batch command question, start excel temp.xls
I wanted to know that if I do
start excel temp.xls
The os will start a new excel instance and open the workbook temp.x开发者_运维技巧ls in that instance, AS AN ATOMIC action.
Right now what I have is
start excel
start temp.xls
And most often these two command will mess up my other excel instance, ie, opening temp.xls in another excel instance that has another workbook already opened.
Thanks,
While I think that "start excel temp.xls" will open temp.xls in the Excel instance started by start, you'd be on the safe side, if you use
"<PathToExcel>excel" [/<opt>] "<PathToXls>temp.xls"
For opt see cli for excel (pick the docs for your version).
The Command-line switches for Excel 2007 document explains the switches:
You can change certain aspects of how the program starts by adding subcommands called switches to the Excel.exe command. A switch appears as a space after the main command, followed by a slash mark (/) and the name of the switch. The switch is sometimes followed by another space and then one or more specific instructions called parameters, which give the program further information about how to execute the Excel.exe command.
In your case you do not use a switch but a parameter. It is used to give the program further information about how to execute the Excel.exe command.
Parameter: file name
Description: starts Excel and opens the specified file.
So I would assume that the parameter is bound to the excel instance started.
精彩评论