Script to kill/restart rdpclip?

7

5

We use remote desktop a lot (XP to Server 2003), and people are having trouble with the clipboard randomly not working. After ensuring that all drives were selected for the remote connection, and rdpclip was killed/restarted, the clipboard works again.

I'm wondering if there's a way I can automate this process for the users so I don't have to manually kill and restart rdpclip every time it stops working for someone. Could I write a batch file that would kill rdpclip and restart it only for the current user? Is there a better solution?

user73073

Posted 2011-03-23T14:03:18.247

Reputation: 173

thx, works fine! – Ice – 2011-05-10T08:07:39.907

Answers

8

taskkill /f /im rdpclip.exe /fi "username eq %USERNAME%" && rdpclip

user1686

Posted 2011-03-23T14:03:18.247

Reputation: 283 655

3

To restart it in a .bat:

taskkill /f /im rdpclip.exe /fi "username eq %USERNAME%"
start rdpclip.exe
exit

Cedric

Posted 2011-03-23T14:03:18.247

Reputation: 31

2

I would recommend to make it(batch) wait a second between taskkill and start. Without it i faced a problem several times: system had not yet killed the proccess by the time the start command came in. So the new proccess didn't start, and the old got killed. Result: no rdpclip.exe at all =(

cls
taskkill /F /FI "USERNAME eq %username%" /IM rdpclip.exe
ping -n 1 -w 1000 1.1.1.1>nul
start rdpclip.exe

Save as .bat.

Egor

Posted 2011-03-23T14:03:18.247

Reputation: 21

I was wondering why ping is used instead of timeout and looked around. If anyone else is curious; from https://ss64.com/nt/timeout.html: “A delay can also be produced by the PING command with a loopback address, there is a delay of 1 second between each consecutive ping.

In tests PING consumes less processor time than Sleep.exe or Timeout.exe, this allows other processes to run in the background.”

– bugybunny – 2020-02-10T10:42:46.617