Shutdown /l shutting down the computer, not logging off.

linuxfan1

New member
Local time
7:54 PM
Messages
1
I made this bat file to protect my files from my mom. Unfortunately if I want her to be able to log off of my locked account and go back to hers, the bat file shuts down the computer instead of logging off. :mad: I cant figure it out and it cant leave a log cuz, well, it shut down. So im stuck. Ill post the code and see if anyone can fix it
Thanks in advance,
linuxfan1



Code: Click me
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Home Editon - Windows 10 Proffesional Build 10130

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Ultimate x64 SP1
CPU
AMD Phenom 2 1090T
Motherboard
Gigabyte GA-890FXA-UD5
Memory
2x8GB Kingston HyperX Fury Black 1600Mhz Unganged
Graphics Card(s)
MSI GTX 970 Gaming 4G
Sound Card
Realtek On-Board HD 7.1 Audio / Logitech G35
Monitor(s) Displays
3xAcer GD245HQ
Screen Resolution
1920x1080
Hard Drives
Samsung 850 Pro 512GB SSD - OS /
WD Caviar Black SATA 3 - 1 TBx2 - Dynamic RAID 0 /
WD Caviar Green SATA 2 - 640GBx2 - Dynamic RAID 0 /
WD Caviar Green SATA 2 - 640GB - Internal Backup /
Seagate Barracude SATA 3 - 3TB - External Backup/ Sync
PSU
HighPower 1000W
Case
Cooler Master HAF 932
Cooling
Noctua NH-D14
Keyboard
Logitech G19
Mouse
Logitech G500
Internet Speed
100/4 Mbit Cable (100GB quota)
Antivirus
ZoneAlarm Extreme Security / MBAM Pro / MBAE Free / SAS Free
Browser
IE 11 - Firefox - Chrome
Other Info
Logitech F710/ G27/ G940/ Z5500 // TrackIR 5 // Nvidia 3D Surround Vision
This is what linuxfan1 posted:

Code:
@echo off
 taskkill /f /IM explorer.exe 
 echo Enter password to login, Enter * to logout:
 SET /P M=
 IF %M%==password GOTO :start
 IF %M%==* "C:\Users\Nathan\Desktop\Old Desktop\Logoff.bat"
 :start
 start C:\Windows\explorer.exe
 taskkill /pid cmd.exe

Also need logoff.bat which was not posted.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Also need logoff.bat which was not posted.
Missing the most relevant piece of information, Linuxfan.

What is the purpose of a Logoff.bat anyway if (I'm assuming) it only contains shutdown /l? Wouldn’t it be easier to just write
Code:
if %M%==* shutdown /l
instead?

I recommend using the logoff command rather than shutdown /l for logging off the current user.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top