open csv file as excel by using command prompt

I have to open csv file after creating from Powerbuilder.
Upon creating csv file , I have to open csv file as excel file automatically.

So I think it is better to use command prompt.
How could I open csv file as excel by using command prompt?
Sat NunaAsked:
Who is Participating?
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
If the default operation for CSV is to open them in Excel, just calling the CSV file will do.
Usually Office is in PATH, and you can use start excel c:\folder\file.csv.
0
 
Rgonzo1971Commented:
Hi,

pls try something like

"c:\program files\microsoft office\office12\excel.exe" "c:\newfile.csv" 

Open in new window

Adjust the path of Excel accordingly

Regards
0
 
Derek SouterITO Svc Delivery Cons IIICommented:
if i have a file called examples.csv in a folder called downloads on my E: drive - so the path to the file is e:\downloads\examples.csv.   I simply need to call excel.exe and provide the filename path at  the end

so, assuming  that the PATH variable does not already include the path to the Excel exe file, I would need to put in "c:\program files (x86)\microsoft office\office15\excel.exe" to launch Excel (2013)

to launch excel and open the CSV file, I would simply type this command (you need the quotations because of the spaces in the folder path)

"c:\program files (x86)\Microsoft Office\Office15\Excel.exe" e:\downloads\examples.csv
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Sat NunaAuthor Commented:
The path written for location at installed excel seems it depends on where you installed office and what version installed.
So I think if I use this command, I should have located the installed path before.
Can't I use other way or can I locate the path simply by using command prompt or powerbuilder?
0
 
Derek SouterITO Svc Delivery Cons IIICommented:
you could use additional commands to find the excel.exe file, and then build that into the path - however that is a bit more complex.


much easier to accomplish in VBS

strComputer="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = TRUE
Set objWorkbook = objExcel.Workbooks.Open("e:\downloads\examples.csv")

Open in new window

0
 
Sat NunaAuthor Commented:
Than you for your help.
It worked!
0
 
Sat NunaAuthor Commented:
Than you for your solution.
It rather simple than vbs and worlk any pc.
0
 
Sat NunaAuthor Commented:
Yes your solution is best . But I don't know how to change accepted comment.
0
 
Sat NunaAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.