Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default How to get data from CMD line

I need a way to run a command in the CMD window and retrieve the output back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to get data from CMD line

redirect the output into a file and open the file.

--
Regards,
Tom Ogilvy



"Kevin" wrote:

I need a way to run a command in the CMD window and retrieve the output back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default How to get data from CMD line


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default How to get data from CMD line

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default How to get data from CMD line

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default How to get data from CMD line

I dont think its going to work for me, the CMD app that Im running doest even
have a way to select and copy with the keyboard. I cant even hit Alt to get
a drop down menu. The only way to get hte options to come up is to right
click the title bar. This is a lousy interface.....

Is there a sendkey command for mouse functions??

Unfortunatly I dont know anything about using the API, and dont know if that
will work either.

"Bill Pfister" wrote:

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default How to get data from CMD line

Is there a sendkey command for mouse functions??

Yes - you can essentially emulate anything you do with an input device from
an API call. I usually use http://www.allapi.net for reference.

One approach is to
1) find the windows handle for your CMD box (use "FindWindows" API call)
2) find the location of the window title (I don't recall the api function)
3) use "mouse_event" to simulate a mouse right-click on the title bar
4) use the "sendkeys" to move around on your context/right-click menu and
press enter for confirming your menu selection

Unfortunately, I don't have any examples on handle, but allapi should get
you headed in the right direction.



"Kevin" wrote:

I dont think its going to work for me, the CMD app that Im running doest even
have a way to select and copy with the keyboard. I cant even hit Alt to get
a drop down menu. The only way to get hte options to come up is to right
click the title bar. This is a lousy interface.....

Is there a sendkey command for mouse functions??

Unfortunatly I dont know anything about using the API, and dont know if that
will work either.

"Bill Pfister" wrote:

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default How to get data from CMD line

Thanks for the link, I will have to do some reading....

"Bill Pfister" wrote:

Is there a sendkey command for mouse functions??


Yes - you can essentially emulate anything you do with an input device from
an API call. I usually use http://www.allapi.net for reference.

One approach is to
1) find the windows handle for your CMD box (use "FindWindows" API call)
2) find the location of the window title (I don't recall the api function)
3) use "mouse_event" to simulate a mouse right-click on the title bar
4) use the "sendkeys" to move around on your context/right-click menu and
press enter for confirming your menu selection

Unfortunately, I don't have any examples on handle, but allapi should get
you headed in the right direction.



"Kevin" wrote:

I dont think its going to work for me, the CMD app that Im running doest even
have a way to select and copy with the keyboard. I cant even hit Alt to get
a drop down menu. The only way to get hte options to come up is to right
click the title bar. This is a lousy interface.....

Is there a sendkey command for mouse functions??

Unfortunatly I dont know anything about using the API, and dont know if that
will work either.

"Bill Pfister" wrote:

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default How to get data from CMD line

Kevin, since you don't have any API exposure, I cobbled together an example
to get you started. The majority of the source comes from examples found on
AllAPI.net (original authors and Daniel Kaufmann
)).

Download the file (
http://wcpii.com/Documents/modCaptureCmd.bas_) and rename
the extension to ".bas". Add the module to a workbook and start with the
"CaptureFromNotepad" sub.


"Kevin" wrote:

Thanks for the link, I will have to do some reading....

"Bill Pfister" wrote:

Is there a sendkey command for mouse functions??


Yes - you can essentially emulate anything you do with an input device from
an API call. I usually use http://www.allapi.net for reference.

One approach is to
1) find the windows handle for your CMD box (use "FindWindows" API call)
2) find the location of the window title (I don't recall the api function)
3) use "mouse_event" to simulate a mouse right-click on the title bar
4) use the "sendkeys" to move around on your context/right-click menu and
press enter for confirming your menu selection

Unfortunately, I don't have any examples on handle, but allapi should get
you headed in the right direction.



"Kevin" wrote:

I dont think its going to work for me, the CMD app that Im running doest even
have a way to select and copy with the keyboard. I cant even hit Alt to get
a drop down menu. The only way to get hte options to come up is to right
click the title bar. This is a lousy interface.....

Is there a sendkey command for mouse functions??

Unfortunatly I dont know anything about using the API, and dont know if that
will work either.

"Bill Pfister" wrote:

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default How to get data from CMD line

Thats way cool of you Bill !!!
I have it installed and it works great with the notepad. I'm playing around
with the names in the CaptureFromNotepad sub to use the app Im trying to get
info from. no luck yet, but I'm looking....

Thanks,
Kevin

"Bill Pfister" wrote:

Kevin, since you don't have any API exposure, I cobbled together an example
to get you started. The majority of the source comes from examples found on
AllAPI.net (original authors and Daniel Kaufmann
)).

Download the file (
http://wcpii.com/Documents/modCaptureCmd.bas_) and rename
the extension to ".bas". Add the module to a workbook and start with the
"CaptureFromNotepad" sub.


"Kevin" wrote:

Thanks for the link, I will have to do some reading....

"Bill Pfister" wrote:

Is there a sendkey command for mouse functions??

Yes - you can essentially emulate anything you do with an input device from
an API call. I usually use http://www.allapi.net for reference.

One approach is to
1) find the windows handle for your CMD box (use "FindWindows" API call)
2) find the location of the window title (I don't recall the api function)
3) use "mouse_event" to simulate a mouse right-click on the title bar
4) use the "sendkeys" to move around on your context/right-click menu and
press enter for confirming your menu selection

Unfortunately, I don't have any examples on handle, but allapi should get
you headed in the right direction.



"Kevin" wrote:

I dont think its going to work for me, the CMD app that Im running doest even
have a way to select and copy with the keyboard. I cant even hit Alt to get
a drop down menu. The only way to get hte options to come up is to right
click the title bar. This is a lousy interface.....

Is there a sendkey command for mouse functions??

Unfortunatly I dont know anything about using the API, and dont know if that
will work either.

"Bill Pfister" wrote:

Try using SendKeys (the API version is more robust than the Excel
implementation) to send a Select All / Copy. Then you can read the clipboard
and parse in Excel. Not the best solution but it should work.

Regards,
Bill


"Kevin" wrote:

Unfortunatley that wont work for me, the CMD shell Im using is a striped down
version for a storage array and I cannot change directories or direct to a
file. It is a CMD window that is interating with the storage array and the
commands are VERY limited. the only way I can get the data into excel now is
to select the text and paste it. The only traditional CMD functions I have
on it are to right click the title bar and choose Mark,Copy, Paste, Select
all, Scroll and Find.

"moon" wrote:


I think it's less work if you just send your output to a file.
So 'C:\dir' gives a directory, but to flush the directory contents into a
text file, use:
C:\dir C:\dir.txt

Once you have the text file, it's quite easy to open that with Excel.


"Kevin" schreef in bericht
...
I need a way to run a command in the CMD window and retrieve the output
back
into Excel. Is there a way to do this?

For example if my output below is in the CMD window I want to capture the
Items starting with DEVA.
------------------------------------------------
Systems available on this Manager:
DEVA01-0BF0
DEVA02-0290
DEVA03-0CD0
NoSystemSelected
------------------------------------------------




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a line chart data point revises data table value in Excel ' Ed Smith Charts and Charting in Excel 2 November 16th 12 01:03 PM
How do I set a Trend Line and Remove the Data Line FlexoC Charts and Charting in Excel 2 August 22nd 08 05:15 PM
Cutting a line in a line chart when data series stops DannyS Charts and Charting in Excel 2 August 28th 07 10:38 AM
My rows are off by one row, ie. data on line 10 should line up wi. lindamari New Users to Excel 1 April 19th 05 04:25 PM
Macro problem on, Yellowed line - previous line or next line. Ed Excel Programming 7 March 29th 05 09:37 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"