0

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

2
  • 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, 2012 at 13:32
  • 1.Windows 7 2.Save the results in a file on a windows machine over the network 3.No
    – AlGallaf
    Apr 18, 2012 at 13:34

1 Answer 1

1

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.

2
  • Thank you. What if the Windows machine requires credentials?
    – AlGallaf
    Apr 18, 2012 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, 2012 at 14:02

You must log in to answer this question.

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