Post Reply 
what's wrong with this fragment of windows batch code?
Author Message
justMongo Offline

Monitors

Posts: 3,854
Joined: Sep 2013

Machine: ResMed VPAP Auto (S9)
Mask Type: Full face mask
Mask Make & Model: ResMed Mirage Quattro
Humidifier: ResMed H5i
CPAP Pressure: 18 IPAPmax - 11 EPAPmin, PS=5
CPAP Software: Other Software

Other Comments: μολὼν λαβέ

Sex: Male
Location: Калифорния

Post: #1
what's wrong with this fragment of windows batch code?
This logoff code does not work. It's a fragment I want to use at the end of a longer batchfile that runs unattended; and for security, I need it to logoff when done. It's a single user Win 7 machine where I am the only user. But, I have a password on the account; and from GUI, I can logoff.
The TIMEOUT command seems to set a delay and work (I want remote disc writes to finish); but, no logoff occurs.

@ECHO OFF
REM LOGOFF BATCH FILE
REM WAIT 30 SECONDS
TIMEOUT /T 30 /NOBREAK
C:\Windows\System32\shutdown /l /f /t 30

=============
This fragment doesn't work either:

ECHO SHUTDOWN BATCH FILE
ECHO WAIT 30 SECONDS
TIMEOUT /T 30 /NOBREAK
C:\Windows\System32\shutdown /s /f /t 30

Perhaps, I need to set it to run as "admin"???

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
05-01-2015 01:59 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
Terry Offline

Advisory Members

Posts: 553
Joined: May 2014

Machine: Philips Respironics RemStar Auto with A-Flex (560P)
Mask Type: Nasal pillows
Mask Make & Model: P/R Nuance & Pap Cap
Humidifier: Integrated
CPAP Pressure: Auto
CPAP Software: SleepyHead

Other Comments:

Sex: Male
Location:

Post: #2
RE: what's wrong with this fragment of windows batch code?
You need to be an admin to run shutdown.

rundll32.exe user32.dll,LockWorkstation

might lock it. Not sure what permission that needs.

Terry


(05-01-2015 01:59 PM)justMongo Wrote:  This logoff code does not work. It's a fragment I want to use at the end of a longer batchfile that runs unattended; and for security, I need it to logoff when done. It's a single user Win 7 machine where I am the only user. But, I have a password on the account; and from GUI, I can logoff.
The TIMEOUT command seems to set a delay and work (I want remote disc writes to finish); but, no logoff occurs.

@ECHO OFF
REM LOGOFF BATCH FILE
REM WAIT 30 SECONDS
TIMEOUT /T 30 /NOBREAK
C:\Windows\System32\shutdown /l /f /t 30

=============
This fragment doesn't work either:

ECHO SHUTDOWN BATCH FILE
ECHO WAIT 30 SECONDS
TIMEOUT /T 30 /NOBREAK
C:\Windows\System32\shutdown /s /f /t 30

Perhaps, I need to set it to run as "admin"???
05-01-2015 02:03 PM
Find all posts by this user Post Reply Quote this message in a reply
Crimson Nape Offline

Monitors

Posts: 1,332
Joined: Oct 2014

Machine: ResMed S9 Autoset
Mask Type: Other
Mask Make & Model: P-10 / F&P Simplus / DreamWear
Humidifier: H5i w/Climateline
CPAP Pressure: 8 - EPR 3
CPAP Software: SleepyHead

Other Comments: CMS-50F & 50IW

Sex: Male
Location: Georgia

Post: #3
RE: what's wrong with this fragment of windows batch code?
JustMongo,
Try using this syntax: shutdown -l

Before I posted this and looked like a total idiot, I put it in a batch file and it worked. Now I'm just a half an idiot.

Statistics prove that people who have more birthdays live longer.
05-01-2015 03:40 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
GeoffD Offline

Preferred Members-2

Posts: 194
Joined: Sep 2014

Machine: ResMed Airsense 10 AutoSet
Mask Type: Nasal pillows
Mask Make & Model: ResMed AirFit P10
Humidifier: Integral + ClimateLine
CPAP Pressure: 14-17
CPAP Software: ResScan

Other Comments:

Sex: Male
Location: New England

Post: #4
RE: what's wrong with this fragment of windows batch code?
Reformat your drive, install Linux, and use /etc/shutdown Smile
05-07-2015 08:25 PM
Find all posts by this user Post Reply Quote this message in a reply
Mark Douglas Offline

Advisory Members

Posts: 513
Joined: Apr 2015

Machine: Sys 1 (60) RemStar BiPAP Auto with Bi-Flex 760P Auto Bi-Level (Variabl
Mask Type: Nasal mask
Mask Make & Model: PR Wisp
Humidifier: PR Sys One heated
CPAP Pressure: RiseTime 3 Fxd E-9.0 / I-11.5
CPAP Software: SleepyHead EncoreBasic

Other Comments: Hashimoto's thyroiditis.

Sex: Male
Location: SW Ohio

Post: #5
RE: what's wrong with this fragment of windows batch code?
(05-07-2015 08:25 PM)GeoffD Wrote:  Reformat your drive, install Linux, and use /etc/shutdown Smile

Best answer! LOL

I use my PAP machine nightly and I feel great!
Updated: Philips Respironics System One (60 Series)
RemStar BiPAP Auto with Bi-FlexModel 760P -
Rise Time x3 Fixed Bi-Level EPAP 9.0 IPAP 11.5 (cmH2O)
05-07-2015 09:31 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
surferdude2 Offline

Advisory Members

Posts: 1,077
Joined: Jul 2014

Machine: ResMed S9 AutoSet
Mask Type: Full face mask
Mask Make & Model: Mirage Quattro & Optilife
Humidifier: ResMed H5i @ #3 if nose breathing & #5 if mouth breathing
CPAP Pressure: 12 ~ 20 & 11 ~12 if nasal mask
CPAP Software: ResScan SleepyHead

Other Comments: Late stage 2 emphysema

Sex: Male
Location: Mousetown, Southern Illinois

Post: #6
RE: what's wrong with this fragment of windows batch code?
Consider using CrapCleaner to do your shutdown. The following line will run CC, which will execute however you last set it, and then shut down your system.

"C:\Program Files\CCleaner\CCleaner64.exe" /auto /shutdown

Two birds, one stone.
05-07-2015 09:45 PM
Find all posts by this user Post Reply Quote this message in a reply
justMongo Offline

Monitors

Posts: 3,854
Joined: Sep 2013

Machine: ResMed VPAP Auto (S9)
Mask Type: Full face mask
Mask Make & Model: ResMed Mirage Quattro
Humidifier: ResMed H5i
CPAP Pressure: 18 IPAPmax - 11 EPAPmin, PS=5
CPAP Software: Other Software

Other Comments: μολὼν λαβέ

Sex: Male
Location: Калифорния

Post: #7
RE: what's wrong with this fragment of windows batch code?
I got it to work with shutdown -L
Everything I read says to preface switches with / not -

Mongo

INFORMATION ON APNEA BOARD FORUMS OR ON APNEABOARD.COM SHOULD NOT BE CONSIDERED AS MEDICAL ADVICE. ALWAYS SEEK THE ADVICE OF A PHYSICIAN BEFORE SEEKING TREATMENT FOR MEDICAL CONDITIONS, INCLUDING SLEEP APNEA. INFORMATION POSTED ON THE APNEA BOARD WEB SITE AND FORUMS ARE PERSONAL OPINION ONLY AND NOT NECESSARILY A STATEMENT OF FACT.
05-07-2015 09:50 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
surferdude2 Offline

Advisory Members

Posts: 1,077
Joined: Jul 2014

Machine: ResMed S9 AutoSet
Mask Type: Full face mask
Mask Make & Model: Mirage Quattro & Optilife
Humidifier: ResMed H5i @ #3 if nose breathing & #5 if mouth breathing
CPAP Pressure: 12 ~ 20 & 11 ~12 if nasal mask
CPAP Software: ResScan SleepyHead

Other Comments: Late stage 2 emphysema

Sex: Male
Location: Mousetown, Southern Illinois

Post: #8
RE: what's wrong with this fragment of windows batch code?
That doesn't make any difference, either - or / should work. You just can't use the /t switch with the /l. I've never had any program squawk when using shutdown /l and letting the system handle the rest.
05-07-2015 11:23 PM
Find all posts by this user Post Reply Quote this message in a reply
surferdude2 Offline

Advisory Members

Posts: 1,077
Joined: Jul 2014

Machine: ResMed S9 AutoSet
Mask Type: Full face mask
Mask Make & Model: Mirage Quattro & Optilife
Humidifier: ResMed H5i @ #3 if nose breathing & #5 if mouth breathing
CPAP Pressure: 12 ~ 20 & 11 ~12 if nasal mask
CPAP Software: ResScan SleepyHead

Other Comments: Late stage 2 emphysema

Sex: Male
Location: Mousetown, Southern Illinois

Post: #9
RE: what's wrong with this fragment of windows batch code?
BTW, If you really need the wait time before logging out, you can use a simple public domain executable called logout.exe which I have had good luck with. http://sourceforge.net/projects/logout/files/latest/download

Put that somewhere on your path (e.g., Windows\system32 folder) or in same directory as your batch file.

Example batch script line to use instead of C:\Windows\System32\ shutdown /l /f /t 30:

logout.exe 1

That gives a one-minute delay before logging you off.
(This post was last modified: 05-07-2015 11:50 PM by surferdude2.)
05-07-2015 11:43 PM
Find all posts by this user Post Reply Quote this message in a reply

Donate to Apnea Board
leximorph19 Offline

Members

Posts: 9
Joined: Feb 2015

Machine: Philips Respironics REMstar Auto A-Flex 60 series
Mask Type: Nasal mask
Mask Make & Model: Respironics WISP
Humidifier: System One 60 series humidifier
CPAP Pressure: 6-11 cm H20
CPAP Software: SleepyHead EncoreBasic

Other Comments:

Sex: Male
Location:

Post: #10
RE: what's wrong with this fragment of windows batch code?
Nice one.
I downloaded logout.exe and tried it.
Works like a charm.

:-)
05-08-2015 01:37 AM
Find all posts by this user Post Reply Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Still want Windows 10 for free? AlanE 1 220 09-23-2016 07:23 PM
Last Post: AlanE
  a little help with PHP code for logins justMongo 12 411 09-19-2016 06:08 PM
Last Post: eseedhouse
  Windows 7 and 8.1 Users Crimson Nape 20 775 08-25-2016 08:10 PM
Last Post: FrankNichols
  Windows 10 - Install Heads-Up and a Vent Crimson Nape 11 442 07-24-2016 02:51 PM
Last Post: justMongo
  It's Windows update Tuesday justMongo 8 1,108 02-10-2016 07:04 PM
Last Post: AlanE
  Sysinternals Suite update (Windows) AlanE 1 379 01-12-2016 07:38 PM
Last Post: DariaVader
  Windows 10 AlanE 103 10,063 11-17-2015 12:12 PM
Last Post: AlanE

Forum Jump:

Who's Online (Complete List)