DOS command to bring up "Turn off computer" window? - batch-file

I would like to create a batch file that brings up the Windows "Turn off computer" window, rather than the user doing so through the usual Start / Turn off Computer method.
Here's a picture of the window I would like to bring up using a DOS batch file :-
http://i.imgur.com/dMprQ.jpg
Does anyone know of a way to do this using a DOS / Batch file method ?
Many thanks,
Martin

Shutdown windows with batch file

Related

is there a way to open "My Location" from Command Prompt for Windows Maps?

Im trying to create a batch file that runs from the command line that opens Windows maps with my location to another specific location. Any suggestions on what this batch file should look like?
I tried this but it didn't work:
start ms-drive-to:?destination.name=Green Lake
From https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-maps-app
Try
ms-drive-to:?destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake
There is also walk-to:
ms-walk-to:?destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake
To do this from a batch file try
explorer "ms-drive-to:?destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake"
Which also works from the run prompt.

How can I write a batch file to run a specific command?

I'm trying to make a batch file that will run the following command:
control name Microsoft.Personalization page pageWallpaper
How do I do this?
EDIT: I should be more specific. I know how to create a batch file but all I have written in the file is the code above, which just flashes a window and then does nothing.
The following should do what you need:
#echo off
control /name Microsoft.Personalization /page pageWallpaper
The syntax of control.exe requires the slashes before name and page.
Source: Add classic personalization menu in Windows 10 build 10074
Also, Command Line Commands for Control Panel Applets helped lead me to the answer.
I started by googling "windows control.exe command line options".
You know how to create batch files, but if you have any trouble putting the code above into a batch file and running it, and cannot figure out how, please let me know.
This works for me, running:
C:\bin> ver
Microsoft Windows [Version 10.0.14393]
Hope it works for you!
Regards,
Lud nom

Setting user name and password to browser from the Batch file

I have created a batch file to open a browser. But I need to know how to interpret the user name and password from the batch file.
Below is my batch file. Can anyone please help?
FYI, I'm just using the normal .bat file (from notepad).
#ECHO ON
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE https://www.myhcl.com/Login/home.aspx
There is no "native" way for a bat file to interact with a window. I would use powershell or VB script for this task but it will be quite a mess.
An easy way is to use AutoIt. It's realy simple and allows you to fully interact with a browser. You could ither use the AutoIt interpreter from within your bat file to manipulate the browser window or just create an au3 or even an exe file that starts the browser and enters the login data.
If you decide to use AutoIt and need help with the script just ask me.

Using a batch file on Desktop to start shortcut on AllUsersDesktop

I use a remote support program to access agent's computers to set them up to work with our dialer.
I use a script via that remote program that adds IE shortcuts to their desktop. To make this script work for any variety of computer setups, the shortcuts are created on the AllUsersDesktop.
I also install a program (called Ventrilo) that creates a shortcut on the specific desktop they are on when I remote into their system.
I would like to add a batch file they can execute that will automatically open the shortcut to Ventrilo and open the IE shortcut on the AllUsersDesktop.
The batch file I have is as follows:
#echo off
start Ventrilo.lnk
start Shortcut.lnk
This opens Ventrilo but not the Shortcut. I am certain it is because the Shortcut is on the AllUsersDesktop, while the shortcut to Ventrilo is not. However, I cannot figure out how to use that start command in conjunction with %AllUserDesktop%
%allusersprofile%\desktop\shortcut.lnk
Type set in a command prompt.
You can start IE by calling start on iexplore, no need to run the shortcut.
start iexplore
Alternatively GoughW's answer should do the trick to.
Make sure you have an end line at the end of your
start shortcut.lnk
in your batch file.

hiding the running program window

I have .mp3 converted as .exe to
make it as self playing its done.
But a window is appearing while
music is playing.
I want to hide
that window while music is
playing [only using .bat file code]
So please help me for the .bat
file code
There is no way to hide a window in pure batch, your best alternative is to relaunch yourself (the .bat) with the START command and the /MIN switch, this would run it minimized and not hidden (You would use a special parameter and check %1 to see if you need to relaunch or not)

Resources