Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got an rdp file which I use to connect to a specific user. In this file, I've specified a batch script I want to be run on connect. However after the script is run on, I get disconnected. If I try to run

mstsc my-connection.rdp /console

I get logged in alright, but my script isn't run. What I want is a normal RD-connection, with this script run in the background, and when it's finished, my connection will remain. I'm sure there's a simple solution to this, but I'm not sure how to do it.

share|improve this question
Put a shortcut to the script in the startup folder on the server for the user or call it from the HKCU|Software|Microsoft|Windows|CurrentVersion|Run key on the server for the user. You could also call the script in a login script for the user. –  joeqwerty Apr 3 '12 at 10:48
@joeqwerty Thanks. It's not quite what I want though - I want the script to be run only when connecting through this specific rdp file, not whenever anyone logins to that user. –  Marxama Apr 4 '12 at 10:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.