title: Batch file to shutdown computer through remote desktop in Windows XP
body: <p>I have a Windows Vista workstation that I use the majority of the time, but I occasionally need to remote desktop into a Windows XP workstation. Because of the differences in resolution, the start menu in my remote desktop session is not visible unless I either full-screen (which I like to avoid so I can still see the start menu and notification tray on my vista workstation) or scroll to the bottom (but I'm lazy!).</p>
  
  <p>I decided to create a <strong>batch file to shutdown the Windows XP machine while using Remote Desktop into it</strong>. It's important that it have a prompt of some kind in case I were to somehow accidentally click it from the desktop.</p>
  
  <p>Here's the batch file source:</p>
  
  <pre><code>pause
  
  echo 1
  shutdown /s /f
  echo 2
  </code></pre>
  
  <p>Yet the file seems to loop at the shutdown command. Here's the output from the batch file:</p>
  
  <pre><code>C:\Documents and Settings\Kiley\Desktop&gt;pause
  Press any key to continue . . .
  
  C:\Documents and Settings\Kiley\Desktop&gt;echo 1
  1
  
  C:\Documents and Settings\Kiley\Desktop&gt;shutdown /s /f
  
  C:\Documents and Settings\Kiley\Desktop&gt;pause
  Press any key to continue . . .
  </code></pre>
  
  <p>It seems to loop like this over and over. I've googled the issue in hopes that this is a common problem with a workaround, but I cannot seem to find an explanation. I've tried using the /t switch as well (to specify time), as well as doing an exit command immediately after the shutdown, and it always seems to produce the same behavior as above.</p>
  
  <h2>I also tried creating a similar but different batch file like so...</h2>
  
  <pre><code>@ECHO OFF
  
  :choice
  set /P c=SHUTDOWN[Y/N]?
  if /I "%c%" EQU "Y" goto :do_shutdown
  goto :choice
  
  
  :somewhere
  
  shutdown -s -f
  </code></pre>
  
  <p>But as soon as I type "y" and press enter, the batch file exits and the machine does not shutdown.</p>
  
  <p>Does anyone have any thoughts, advice, or suggestions? The problem is of little importance, but now I'm just curious...</p>
  
  <p><strong>EDIT:</strong>
  It was suggested that I try using the "-" character to denote a switch instead of "/". This produces the same behavior. However, what's interesting is that I am able to run the following command in a command prompt from the XP workstation to correctly commence shutdown from a command prompt:</p>
  
  <pre><code>shutdown -s
  </code></pre>
  
  <p>I tried using the /m switch from my vista workstation, and the command prompt that pops up when double-clicking the batch file exits as soon as the shutdown command is issued. When I try running the shutdown command with the /m switch from the command prompt by itself, I get the following output:</p>
  
  <pre><code>C:\Windows\system32&gt;shutdown /s /f /m \\WORKSTATION-V5
  WORKSTATION-V5: Access is denied.(5)
  </code></pre>