Starting a bat file on networked computer from local bat file question


  1. Posts : 51
    Windows 7 Home Premium 64bit
       #1

    Starting a bat file on networked computer from local bat file question


    Hello everyone,

    I have a bat file that is launched when a torrent finishes downloading on my laptop which launched robocopy to copy it to my server computer.

    I want to have the server run a few programs to extract the file and move it to the correct directory structure.

    I want to launch a bat file on the server from the first bat file using the call command, however I am not sure if this command will cause my server to execute the bat or my laptop to execute the bat.

    Is there a way to get my server to run the bat from the bat that is run on my laptop?

    I think that if I use the call command that it will run the called bat on my laptop even though the bat is located on my server.

    Thanks in advance
    -S
      My Computer


  2. Posts : 1,800
    Windows 7 Pro x64 SP1
       #2

    Your exactly correct that the batch file will run on your laptop. The only way to run from the server is to use Remote desktop RDP from your machine to the server which will allow you to run the program in the server's memory.
    Or, you could have a planned event (Task Manager) on your server which would check to see if the file exists at some point in time and then run the batch program in the servers memory space.

    Rich
      My Computer


  3. Posts : 51
    Windows 7 Home Premium 64bit
    Thread Starter
       #3

    Thanks so much Rich for the reply. I was using the task scheduler to run the bat every 5 minutes, however this lead to some problems if the files were being copied at the time that the bat was started.

    Would you be able to help me config a way to have a planned event on my server "Check" to see if a file exists and then run a batch program?

    Thanks
    -S
      My Computer


  4. Posts : 51
    Windows 7 Home Premium 64bit
    Thread Starter
       #4

    One thing that I posted a while ago in another forum was the event trigger function within the task scheduler. If I knew which log to monitor, what source and the Event ID for a file creation, then I could use the Task Scheduler to run my bat file on my server computer with out setting up a time loop. There are other small programs out there that will monitor a folder and launch a program like a bat file, but it would be nice to get away from third party software and keep a little running on my server as possible.

    Anyone know how to set this up?

    Thank you very much
    -S
    Attached Thumbnails Attached Thumbnails Starting a bat file on networked computer from local bat file question-tash-scheduler-1.jpg  
      My Computer


  5. Posts : 881
    Windows 7 Ultimate x64
       #5

    You could setup a ssh server or telnet server (telnet is not secure). The batch file could open up a session and run the command through the session.

    I know with putty you can have a txt file with commands listed then once the command runs it will shutdown.

    example:
    putty.exe -load "Session name" -l "username -pw "Password" -m c:\test\command.txt

    command.txt:
    netstat -a

    When you run the example above it will open the shh connection (I use sessions that i have already created). Once the connection is open it will run the command in the command.txt file, then close the connection.
    Last edited by Parman; 22 Oct 2012 at 11:52.
      My Computer


  6. Posts : 1,800
    Windows 7 Pro x64 SP1
       #6

    In a batch file, you can have goto points.
    :start
    if exist xxx.txt goto ok1
    exit
    : (put ok1 here) in this forum the ok with a colon in front is an emoticon.
    putyour executeor batch file here
    exit
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:56.
Find Us