What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » experimenting with Wscipt.shell

experimenting with Wscipt.shell
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: experimenting with Wscipt.shell
quote:
Originally posted by SmokingCookie
You'll need to output some stuff that is known to your script; things it'll be looking for. An example:

Batch code:
ECHO !BEGINBATCH! >> Output.txt
@ECHO OFF
ECHO !ENDCOMMAND! >> Output.txt
ipconfig /all >> Output.txt
ECHO !ENDCOMMAND! >> Output.txt
DIR C:\ >> Output.txt
ECHO !ENDCOMMAND! >> Output.txt
ECHO !ENDBATCH! >> Output.txt

Then have the script load the file and search for "!BEGINBATCH!", "!ENDCOMMAND!" and "!ENDBATCH!".

NB you'll need to know where Output.txt is located. I don't really know where you'll find it; you'll need to experiment with that.
Such a batch file is not needed. It is making things way too limited and too complicated.

If you take the "redirecting the command line" approach (which is already a complicated thing if you want to do it right), 'all' you need to do is to add something like "> UNIQUENAME.TXT" to the command line you've send to your remote pc.

------------------
Note that that is just a simply example, the stuff you actually need to add will be a bit more complicated as you also need to catch errors and messages which are not send to the standard output but to the secondary error stream. People who often work in DOS know what I mean; eventhough you used "> file.txt" sometimes stuff will still be printed on the screen.
eg: do "dir :: > file.txt".

So, you actually need to add "> UNIQUENAME.TXT 2>&1" to also redirect the STDERR stream to the STDOUT stream.

UNIQUENAME must be unique, as you do not want to overwrite an existing output file from a previous command which is still running.
------------------


But the hard part is that you need to wait until the command has finished before you can open the output file and send it. And if you get the command wrong, it might even be that the process will never end to begin with. Also some commands do require keyboard input (eg: "dir /p"). It speaks for its own that doing such commands (even by accident!) will render the whole process useless and the script running this will hang and probably take messenger with it.

But all in all, using this method is very limited; you can only do so much with the command line, and constantly needing to send output files doesn't work that well in practice. So, the method is a very dodgy way of doing things, because...

...If you have only a fixed set of commands you want to use, you far better use Windows APIs to do the stuff directly.

...And if you're not sure about what commands you're going to need (or want to do stuff like file and directory manipulations - you said you want to use DIR, COPY, DEL, etc), I strongly recommend using a Remote Desktop software. There are a lot of free and small Remote Desktop softwares available on the net, not to mention that it is also already available in Windows and directly accessable from Messenger. It has also the benefit that you would still be able to access your remote pc and do stuff when Messenger has problems logging in, etc. Imagine you're doing some file/dir maintenance and suddenly Messenger disconnects, then you're screwed... With remote desktopping you wont have that problem.

This post was edited on 04-03-2010 at 06:57 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
04-02-2010 11:04 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
experimenting with Wscipt.shell - by scripto on 03-30-2010 at 11:35 AM
RE: experimenting with Wscipt.shell - by matty on 03-30-2010 at 01:11 PM
RE: experimenting with Wscipt.shell - by Spunky on 03-30-2010 at 05:00 PM
RE: experimenting with Wscipt.shell - by matty on 03-30-2010 at 05:05 PM
RE: experimenting with Wscipt.shell - by scripto on 03-30-2010 at 05:57 PM
RE: experimenting with Wscipt.shell - by matty on 03-30-2010 at 06:28 PM
RE: experimenting with Wscipt.shell - by djdannyp on 03-30-2010 at 06:36 PM
RE: experimenting with Wscipt.shell - by scripto on 03-30-2010 at 07:05 PM
RE: experimenting with Wscipt.shell - by matty on 03-30-2010 at 07:10 PM
RE: experimenting with Wscipt.shell - by scripto on 03-30-2010 at 07:46 PM
RE: experimenting with Wscipt.shell - by CookieRevised on 03-31-2010 at 11:13 AM
RE: experimenting with Wscipt.shell - by scripto on 03-31-2010 at 07:52 PM
RE: experimenting with Wscipt.shell - by CookieRevised on 04-01-2010 at 02:37 AM
RE: experimenting with Wscipt.shell - by scripto on 04-01-2010 at 05:57 PM
RE: experimenting with Wscipt.shell - by CookieRevised on 04-02-2010 at 10:39 AM
RE: experimenting with Wscipt.shell - by scripto on 04-02-2010 at 12:13 PM
RE: experimenting with Wscipt.shell - by CookieRevised on 04-02-2010 at 01:44 PM
RE: experimenting with Wscipt.shell - by scripto on 04-02-2010 at 02:52 PM
RE: experimenting with Wscipt.shell - by SmokingCookie on 04-02-2010 at 06:42 PM
RE: experimenting with Wscipt.shell - by CookieRevised on 04-02-2010 at 11:04 PM
RE: experimenting with Wscipt.shell - by scripto on 04-03-2010 at 12:04 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On