executing batch files remotely

Discussion in 'OT Technology' started by ttah, Jan 15, 2004.

  1. ttah

    ttah Guest

    I have computer x and computer y on the same lan.

    How do I kick off a batch file on computer x from computer y and maintain
    all the same working folders as if I launched it locally on computer x?
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    You schedule the batch file on the remote computer. Then you can use the GUI to start the task remotely, or use the AT command at the command line.
     
  3. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    the batch file resides on computer x in a fileshare

    computer y runs the batch file from the share, and the batch file calls unc paths back on computer y (which must also be shared)
     
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    UNC paths aren't supported on a number of functions in batch programming. It sucks :(
     
  5. Mirlyn

    Mirlyn Guest

    Try pstools (free). There is a utility called psexec that can do a hands-free telnet-like session to the other computer. There you can run programs remotely. Downside is the file must reside on the remote machine already. If you're crafty, you can put it there with batch programming.
     
  6. ttah

    ttah Guest

    I can't do this if the remote box is win xp home can I?
     
  7. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    install cygwin on the computer that you need to remotely run scripts on. You can even have it setup OpenSSH which is secure vs. telnet. Cygwin is basically a bash shell for your windows box

    http://www.cygwin.com
     
  8. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Umm - good question - never tried. You'd have to give access to do it - I never work in non-domain environments though.
     
  9. ttah

    ttah Guest

    it's already got cygwin. the only problem is the guy who needs to run these apps is even less computer inclined than myself. so telneting and remote admining is out of the question. i might just have to set up a web server and make him a web page that says "click here".
     
  10. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    that might work bro. Not too hard to do in PHP or ASP i know. Not sure about anything else. I do that with my x-10 stuff in my house ;)
     
  11. Mirlyn

    Mirlyn Guest

    Why not just put a shortcut on his desktop to this batch file? Then he or you could launch it.
     
  12. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    gotta be done remotely
     
  13. Mirlyn

    Mirlyn Guest

    just off the top of my head...

    c:\pstools\psexec.exe computer_name -u administrator -p password
    echo @echo off >> "c:\documents and settings\user\deskop\runthis.bat"
    echo title Preparing to start your file... >> "c:\documents and settings\user\deskop\runthis.bat"
    echo echo starting a batch file for you... >> "c:\documents and settings\user\deskop\runthis.bat"
    echo start "c:\program files\software\something.exe" >> "c:\documents and settings\user\deskop\runthis.bat"
    echo exit >> "c:\documents and settings\user\deskop\runthis.bat"
    exit

    want to schedule it? Might add something like this at the end...
    at 1:00 /EVERY:MWTh "c:\documents and settings\user\deskop\runthis.bat"

    Maybe I'm missing something....

    Actually....without trying it, I can't remember.....I think psexec can transfer and run a batch file, so you probably could cut that part out.
     
  14. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    oh. then i would substitute net use commands to establish drive letters and use the letters in the batch file.

    i love the pstools and use them everyday. cygwin is a bit heavy for this purpose
     

Share This Page