Terminal Server - Execute a Batch file from within a Terminal Server that executes on local machine

Posted on 2007-10-16
Last Modified: 2008-01-09
I have a need to be able to log in to a Terminal Server, and run a batch file that runs not within the Terminal Server Session, but from my local computer that I have RDP's from. Once the batch file is started, I would want the Terminal Session to continue  as it was prior to the batch file being this possible
Question by:rrudolph
    LVL 2

    Expert Comment

    Yes, log onto the Terminal Server then minimize the session window and run the batch file.

    When you maximize the session window again all process continue to run on the local PC.

    Is this what you are asking?

    Author Comment

    Sorry, no that is not what I am asking. I used the batch file example as an easy explanation of what I want to do. The longer version is that I support an application, that needs to run in terminal server mode. I have a couple of program calls that require some action at the local machine level. So I need to be able to call a program from the terminal server session that does not run in the session, but rather goes back to the local host and runs a program.


    LVL 2

    Accepted Solution

    Ah, I see. From a batch file perspective this can be achieved by using psexec (

    You would do something like:

    psexec \\%clientname% cmd.exe

    %clientname% is an environment variable set to the connecting computer name when a user logs onto a terminal server.

    This may or may not be what you're looking for - are you trying to achieve this from within the application you're supporting and therefore need some sort of equivalent API call?

    Author Comment


    this is very close to what I need, in my situation, my computer is named D410

    Using the psexec\\&clientname%...........the returned characters are \\D410:

    the colon is keeping me from running the batch you have an idea as to how I can "strip" that colon?  If so, I can add the rest of the information.



    Author Comment


    Thank you for your ideas. I ran into firewall port issues, but now that I know what they are, I can resolve those.

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
    ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now