General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 17th, 2006, 11:48 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
MS-DOS: Shutdown Command

hey, im just wondering how would i insert a line break after some text in the shutdown -c "" comment area of the shutdown command.

does anyone know??

colton22

Reply With Quote
  #2  
Old August 18th, 2006, 08:48 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
The shutdown command's comment flag only accepts a maximum of 127 characters. I'm not positive a line break is allowed... I'm pretty sure backslash-N doesn't work
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #3  
Old August 18th, 2006, 02:01 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
i tried <br />, which i was pretty sure would not work, it didnt, i tried the \n it didnt work, lol, im still looking though, the reason for this is im creating a file which will defrag/chkdsk/del all temp files/request a chkntfs to run on startup, then the file will restart the computer after extracting a file with the contents "Shutdown -s -t 30 -c "normal shutdown"" and puts that on the scheduled tasks to run on startup, once the chkntfs is done running the system will continue its boot run that file, the file will then in turn delete itself from scheduled tasks, set a shutdown, and delete itself, leaving the computer off, no extra files except the one that started everything, and defraged/cleaned.

sounds like alot but i shoot high in standards i guess

colton22

Reply With Quote
  #4  
Old October 20th, 2006, 04:14 PM
PlJay03 PlJay03 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 2 PlJay03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 48 sec
Reputation Power: 0
I'm not sure I know what you are exactly asking for but the <br> tag in HTML would be similiar to the echo. command in batch files.

Code:
@echo off
echo Hello
echo.
echo World
pause > nul

Reply With Quote
  #5  
Old October 20th, 2006, 07:22 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
what i am talking about is when you get the shutdown comment set it looks like this...

+-----------+
|here is the-|
|comment---|
+-----------+

i need to put a line break, (same as <br /> in html) in this statment.

colton22

Reply With Quote
  #6  
Old January 18th, 2007, 10:03 PM
RobertT RobertT is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 RobertT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 4 sec
Reputation Power: 0
when everyone else uses the shutdown command do they get a box that pop-ups that shows the comment and a timer counting down? I have windows media center i believe and i dont get a pop-up. Just wondering if anyone else did?

Reply With Quote
  #7  
Old January 19th, 2007, 11:26 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
I have windows media, and yes i do get a window, try using this...

SHUTDOWN -S -T 120 -C "Shutdown"

then to cancel that, use

SHUTDOWN -A

colton22
__________________


Hang Out, Listen To Music, Have Fun, and Customize Your Experiance All In One Place! - Colton22's World - This is My World

Reply With Quote
  #8  
Old January 19th, 2007, 11:59 PM
RobertT RobertT is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 RobertT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 4 sec
Reputation Power: 0
Quote:
Originally Posted by colton22
I have windows media, and yes i do get a window, try using this...

SHUTDOWN -S -T 120 -C "Shutdown"

then to cancel that, use

SHUTDOWN -A

colton22


SO THE POPUP DOESN'T WORK WITH THE LOG OFF FUNCTION?

Reply With Quote
  #9  
Old January 20th, 2007, 01:13 PM
RobertT RobertT is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 7 RobertT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 4 sec
Reputation Power: 0
Quote:
Originally Posted by RobertT
SO THE POPUP DOESN'T WORK WITH THE LOG OFF FUNCTION?


EDIT:or the -l function

Reply With Quote
  #10  
Old March 26th, 2007, 02:41 AM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Location: New Springfield, OH
Posts: 154 Nilpo User rank is Private First Class (20 - 50 Reputation Level)Nilpo User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 18 h 1 m 47 sec
Reputation Power: 13
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
In order to insert a line break you'll need to assign your string to a variable. Use the ASCII character 10 for your linebreak. Append the next line, etc. Then use the variable when you call your shutdown command. If all else fails in DOS (or in this case, NT Batch) always resort to ASCII.
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #11  
Old March 26th, 2007, 09:21 AM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 13
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
@Robert, the -l does not display the box for the logoff.

@nilpo, thank you, is there anyway you could give me a sniplet of your code to test? the text is a little hard to convert to batch code, lol

Reply With Quote
  #12  
Old March 26th, 2007, 11:30 AM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Location: New Springfield, OH
Posts: 154 Nilpo User rank is Private First Class (20 - 50 Reputation Level)Nilpo User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 18 h 1 m 47 sec
Reputation Power: 13
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
There are several different way of inserting line breaks in Batch. The easiest method is simply to "escape them". Consider this example:
Code:
@echo off
echo This is line one.
echo This is line two.
This, of course would generate output like this:
Code:
This is line one.
This is line two.


Now consider this alternative. Rather than using separate echo statements, we can do it all in one. (We'll use the ^ for escaping the linefeed character.)
Code:
@echo off
echo This is line one.^

This is line two.


Running this code will produce the same effect because cmd.exe will not produce the escaped line feed character until it is printed on screen.

Assuming we are using the following example:
Code:
shutdown -s -t 30 -c "This is line 1."
We can easily apply our escaping method:
Code:
@echo off
shutdown -s -t 30 -c "This is line1.^

This is line 2."


Although the syntax can be verified by replacing shutdown with other commands, this still does not work. That brings me to the conclusion that shutdown.exe will not accept a forced linefeed. I have since verified this by testing in VBS as well.

From here you have two options:
  1. You could insert the necessary number of spaces to force the dialog to wrap your text to a new line. Since this is displayed using the standard system font, it should display the same on a wide range of machines. Here's how our example would look:
    Code:
    @echo off
    shutdown -s -t 30 -c "This is my comment.                                    It should appear on multiple lines."
  2. Your second option is to use an alternative method. If the computer is running messenger service, NET SEND can be used to display a multi-line popup message. You can include a timeout before executing shutdown.exe with its t flag set to 0. It would look like this:
    Code:
    @echo off
    NET SEND %ComputerName% This is line 1.^
    
    This is line 2.
    ping 1.1.1.1 -n 1 -w 30 > Nul
    shutdown -s -t 00
Hope that helps.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > MS-DOS: Shutdown Command


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap