Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to export the command prompt session result to a host over the network?

share|improve this question
What operating system? And what do you want to happen to those results on the remote host - save them to a file? Pass them as arguments to a new process? Perhaps you could describe in a bit more detail what exactly you're trying to achieve? – Indrek Apr 18 '12 at 13:32
1.Windows 7 2.Save the results in a file on a windows machine over the network 3.No – x76x Apr 18 '12 at 13:34
up vote 1 down vote accepted

If the location where you want to save the file is accessible over the network, then you can simply use command redirection to send the output of your command directly to a file. For instance (with the dir command):

dir > \\SERVER\Path\file.txt

If you want to do this multiple times and append the output to the same file each time, use >> instead of >.

Edit: if the remote machine requires credentials other than those of the logged in user, try this:

net use \\SERVER\Path /user:SERVER\username password
your_command > \\Server\Path\file.txt
net use \\Server\Path /d

The first line connects to the shared folder using the given username and password, and the third line disconnects.

share|improve this answer
Thank you. What if the Windows machine requires credentials? – x76x Apr 18 '12 at 13:40
@looi76 By default it should attempt to use the credentials of the currently logged in user, so you could try creating a user with the same credentials on the remote host and giving it the nexessary permissions. But if you need to use different credentials, see the edit in my answer. – Indrek Apr 18 '12 at 14:02
Thank you. Done. – x76x Apr 18 '12 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .