Is there a command to restart computer into safe mode? [closed] - command-line

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would like to know if there is a command that could be written in the command line to restart the computer and make it boot in safe mode?
If there isn't a command like this, is there any other way to do it?
I would like the process to be fully automated after launching the command.

My first answer!
This will set the safemode switch:
bcdedit /set {current} safeboot minimal
with networking:
bcdedit /set {current} safeboot network
then reboot the machine with
shutdown /r
to put back in normal mode via dos:
bcdedit /deletevalue {current} safeboot

In the command prompt, type the command below and press Enter.
bcdedit /enum
Under the Windows Boot Loader sections, make note of the identifier value.
To start in safe mode from command prompt :
bcdedit /set {identifier} safeboot minimal
Then enter the command line to reboot your computer.

Related

How command prompt works in all operating system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How command prompt communicate with hardware
if i give mkdir command it will create the directory
how this command works internally
can i create own commands.
You need to notice the difference between the OS and the shell. Shell is only a user-land program. When you type a command, the command is the name of another program(or some built-in command in shell itself), shell find the corresponding program and execute it.
The operations at this level is much higher than hardware, it's just user-land program call.
For mkdir, you type which mkdir then will find the path of this program named mkdir. If you want to create your own, just compile your own program and run it from shell.
First of all MKDIR doesn't change the Directory it Makes the new directory.
& These program internally runs like a Bash Script/Batch File, which are few predefined codes in the OS.
You can create your own command by creating Batch File, For which you need Notepad, Little Programing Skill & Output Parameters you Want To Achieve.
This Link Might help Creating CMD File

Get hibernate status [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Is it possible to get hibernation status using shell ?
I am using powercfg.exe to enable/disable it and there doesn't seem to be any way to get the status, even using /Q (query).
I also tried to base that on existence of %SystemDrive%\hiberfil.sys but that requires admin rights.
EDIT
Current solution is outdated:
From version 1809 the registry setting “HibernateEnabled” was renamed “HibernateEnabledDefault”. If you use cmd (powercfg.exe /hibernate off), it is created in addition to the “HibernateEnabledDefault” parameter “HibernateEnabled” with all of the control circuits of the supply.
Setting registry didn't have any effect for me since this version. I had to go to Control Panel\Hardware and Sound\Power Options\System Settings to enable it, after that powercfg options worked again. If both HibernateEnabled and HibernateEnabledDefault are deleted, I still got Hibernate option active.
You could check the registry key:
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Power -name HibernateEnabled
Or remotely using .Net and Remote Registry:
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', "ExampleComputer")
$RegKey = $Reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Power")
$RegKey.GetValue("HibernateEnabled")
Here is an alternative for cmd, based on the registry query by BenH's answer:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled"
To capture the result and store it into a variable, use this:
for /F "delims=" %V in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled"') do set "Hibernate=%V"

How to run an application as "run as administrator" from the command prompt? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a batch file called test.bat. I am calling the below instructions in the test.bat file:
start /min powershell.exe %sysdrive%\testScripts\testscript1.ps1
When I run this through the command prompt, my testscript is running successfully. I want to run it as administrator (as if I have created a desktop shortcut and run as administrator. It shouldn't prompt for any username or password).
I have tried adding /elevate and /NOUAC parameters in the above test.bat, but no luck. How do I fix this issue?
I know how to do it manually, but I want this to be executed from the command prompt.
(By Marnix Klooster): ...without using any additional tools, like those suggested in an answer to Super User question How to run program from command line with elevated rights.)
Try this:
runas.exe /savecred /user:administrator "%sysdrive%\testScripts\testscript1.ps1"
It saves the password the first time and never asks again. Maybe when you change the administrator password you will be prompted again.
See this TechNet article: Runas command documentation
From a command prompt:
C:\> runas /user:<localmachinename>\administrator cmd
Or, if you're connected to a domain:
C:\> runas /user:<DomainName>\<AdministratorAccountName> cmd
It looks like psexec -h is the way to do this:
-h If the target system is Windows Vista or higher, has the process
run with the account's elevated token, if available.
Which... doesn't seem to be listed in the online documentation in Sysinternals - PsExec.
But it works on my machine.

Screen record using VLC - command line - windows xp [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
My objective is to start and stop screen record using VLC from command line.
For starting the screen recording, I used the following code:
vlc screen:// -I rc --screen-follow-mouse --screen-fps 5
:sout=#transcode{vcodec=WMV2,vb=1800,scale=1}:std{access=file,mux=asf,dst=output.wmv}
And for stopping the record I learned from the VLC forums that I have to use ncat for windows and my stop BAT file contents were
echo quit | "C:\Users\Jk\Desktop\Downloads\nc111nt\nc.exe" localhost 8088
But still the stop doesn't work. I also tried the following, but it makes the recorded video corrupted:
taskkill /IM vlc.exe
Also tried
vlc ://quit but it wont work as it was not started in one-instance mode.
To stop, just run:
vlc vlc://quit

What does cmd /C mean? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I can understand cmd but not cmd /c. I was trying to invoke a java program from the current for which I use Runtime.getRuntime().exec("cmd /C java helloworld"); There arises my doubt.
The part you should be interested in is the /? part, which should solve most other questions you have with the tool.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>cmd /?
Starts a new instance of the Windows XP command interpreter
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using ! as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
/V:OFF Disable delayed environment expansion.
/C Carries out the command specified by the string and then terminates.
You can get all the cmd command line switches by typing cmd /?.
CMD.exe
Start a new CMD shell
Syntax
CMD [charset] [options] [My_Command]
Options
**/C Carries out My_Command and then
terminates**
From the help.