# Batch Files

**URL:** <https://forums.speedlife.net/t/batch-files/241261>\
**Category:** Shift518 Off Topic\
**Created:** [January 8, 2009, 1:23pm UTC](https://forums.speedlife.net/t/batch-files/241261 "2009-01-08T13:23:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilya](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/ilya/32/6404_2.png) [@Ilya](https://forums.speedlife.net/u/Ilya)\
**Post date:** [January 8, 2009, 1:23pm UTC](https://forums.speedlife.net/t/batch-files/241261/1 "2009-01-08T13:23:45Z")

</div>

I’m tinkering with batch files at work. I got a couple working (like starting a service that otherwise won’t start in safe mode, etc.) but I’d like to get this one working and am not having any luck.

I want to be able to run this and be prompted for the computer name, countdown, and comment to provide while shutting down a computer remotely. I do this when I have a machine doing something overnight and I don’t want it running till the morning. I shut it down at 2am for example.

Here is what I have.

* * *

:: Remote Shutdown  
:: Shut down a computer remotely  
::  
@ECHO OFF

echo Enter Computer Name:  
set /p computer=

echo Enter Time Countdown:  
set /p t=

echo Enter Comment:  
set /p comment=

echo shutdown -m \%computer% -s -t %t% -c “%comment%”

* * *

When I run the above batch file, I get the prompts but at the end nothing happens. If I remove the last echo, it just loops. Ending at the -s and deleting everything else does nothing either. If I “echo %computer% %t% %comment%” it shows what I typed in when prompted…so the variables are holding the correct data. It’s the line with the actual command that doesn’t work. If I type the command itself into a command line, it’ll shut down the PC in question.

Can someone help me please? I’d appreciate it. I wasn’t able to find what I was looking for online (been googling last hour or so).

Rep points will be given :).

---

<div class="post-metadata">

**Author:** ![Ilya](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/ilya/32/6404_2.png) [@Ilya](https://forums.speedlife.net/u/Ilya)\
**Post date:** [January 15, 2009, 8:08am UTC](https://forums.speedlife.net/t/batch-files/241261/2 "2009-01-15T08:08:29Z")

</div>

I got this all worked out.

I had the batch file named shutdown.bat. I guess you can’t name it the same as the command. Also, I had to remove the last echo (before the command).
