Can I add my own executables or batch scripts to the boot recovery command prompt in windows? - windows

when you boot into windows and screw around with the F-Keys until you get to the repair menu, there is an option to run a command prompt. However, I cannot access any of the files on my PC from that command prompt. Is there any way for me to access them or add my own? Thank you a ton.
The cmd prompt

You could access other files, just cd yourself to other drives(you're
defaulted to driveX) – SteveFest
Perfect!

Related

Can Intellij automatically run commands when opening the embedded terminal?

I use the embedded terminal intellij on Windows and I always run a set of commands as soon as it opens. Commands such as setting aliases etc etc. Is it possible to get intellij to run the automatically?
No, it's not currently supported; please follow IDEA-210036 for updates.
Note that you can set up init script in the AutoRun registry value to execute a set of commands on each cmd.exe start - see
How to run a command on command prompt startup in Windows. But this will affect all your cmd shell instances, not just the cmd.exe in the terminal embedded in WebStorm

PhpStorm - run terminal (cmd) as administrator

On Windows it's easy to run cmd application as administrator:
Right click on cmd icon >> run as administrator`
But I would like to use PhpStorm terminal tool as administrator since I constantly have to execute queries that require administrator role.
When I open:
File >> Settings >> Tools >> Terminal
I can see that it is directly connected to cmd.exe and there are options to be filled:
And I see no checkbox with choice to run it as administrator.
QUESTIONS
Is it even possible?
If yes how do I do it?
Using settings or other way?
There are no options in the IDE for that at the moment: to run the shell (cmd.exe, powershell.exe etc.) with higher rights.
https://youtrack.jetbrains.com/issue/IDEA-121335 -- watch this ticket (star/vote/comment) to get notified on any progress. Maybe someone will post some possible workarounds there...
Your only option for now (that I'm aware of) is running IDE itself as Administrator -- Process Hacker tool confirms that both the IDE and cmd.exe will be run with elevated rights.
P.S.
For one time execution (or if you need to run IDE as normal user) -- have a look at this question and offered solutions: How to open an elevated cmd using command line for Windows?

Open Excel on Jenkins CI

I am working on Windows 7 (logged in as session no.1), my Jenkins CI is running as windows service in session 0.
My problem is.. I want to open an Excel file through Jenkins CI in session 0, but want to display its GUI on session 1.
I know that session 0 is isolated in Windows 7, but is it possible to run a process in session 0 and then output in another session? please help.
Edit:
Took a little trial and error, but this is what finally worked for me (Windows 7 64-bit).
Download PsTools from Microsoft site
We only need psexec.exe, but you can extract everything. Extract to some location accessible by Jenkins, preferably without spaces in the path.
Open elevated command prompt: type cmd into Start's quicksearch, right click cmd.exe, select Run as Administrator.
Type C:\path\to\psexec.exe -accepteula and press enter.
Type C:\path\to\psexec.exe -i 1 cmd and press enter. (If you see a command prompt appear, all is good, close it now)
In Job configuration, configure Execute Windows Batch command step
Write the following:
C:\path\to\psexec.exe -accepteula && C:\path\to\psexec.exe -i 1 cmd /c start C:\PROGRA~2\MICROSO~1\path\to\excel.exe
Where:
C:\path\to is your full path to psexec.exe, unless it is in your %path%
-i 1 is the session ID that you want to launch in.
C:\PROGRA~2\MICROSO~1\path\to is your full path to excel.exe without spaces. Since most Office installations are going to be under paths with spaces, like "Program Files (x86), you have to figure out the short path, or place it somewhere without spaces.
Having excel.exe under %path% and working from regular command line was not enough.
A little explanation for those that care:
psexec needs to install a services first. For that, it needs to be run from elevated command prompt for the first time. This is a one-time installation step.
To make psexec work, you need to accept the EULA prompt. This is done per session/user. So even if you run psexec -accepteula in your command prompt, it doesn't help when Jenkins service (running as Local System in session 0) tries to use it. Therefore, you have to place that into the Jenkins job, along with the command. Technically, it only needs to be there once, and can be removed afterwards, but it definitely doesn't hurt to keep it there.
I've used cmd /k and running this command from my local cmd prompt to debug. This is what made me realize I couldn't find a way to escape the spaces (tried various quoting), so had to resort to short file names. Note that short file names are not required, this is just to escape spaces.
no its not-
plus any UI interactions requires you to run Jenkins as Java web start rather than a service or you can not interact with UI elements.

How to restore bat file execution from explorer on XP

some bat files need to be launched at the start of the session, but they don't.
Actually, when trying to launch one from the explorer, it opens the Open with window instead of just runnig.
However, the bat files still run correctly from the command prompt.
I bet it has been caused by a virus, but the antivirus did not detect anything unfortunately.
Any idea?
Use the Open With command, select cmd.exe, then before you hit OK, check the box that says "always use this program to open this type of file" or something similar.
If cmd.exe is not in the choices, browse to c:\windows\system32, and cmd.exe should be in there.
You can re associate the extension by downloading the reg file for batch from the link below which should solve your problem.
http://www.dougknox.com/xp/file_assoc.htm

Open a file from Cygwin

Is there an equivalent to OSX open command in cygwin. open opens a file with the default application for that type.
I want to do something like
$ magic-command file.xls
#excel opens as if file.xls would have been double-clicked
$ magic-command file.txt
#notepad opens as if file.txt would have been double-clicked
You get the idea?
Basically something like a "cygwin-double-click" command.
You can also use the cygwin utility:
cygstart <your file>
To make things OSX-like add the following to your bashrc
alias open='cygstart'
Don't forget to check out the man page for cygstart.
You can use the start command from the CMD like this:
cmd /c start <your file>
explorer <your file>
works too. What is nice is
explorer .
opens a windows explorer window in the current directory. But then
cygstart .
does the same thing and does more, but I find 'explorer' slightly easier to remember.
I am using Cygwin in Win7. I can run file on windows through ccygwin command line.
cygstart <your file>
when you run this command your file will open in windows.
Under the Windows command-line interpreter (cmd.exe) there is support for the start command. I know of somebody who implemented start in cygwin. You can find the page about it here.
You could also simply call cmd.exe (usually located in /cygdrive/c/windows/system32/cmd.exe) with the following arguments cmd /c "start yourfile.file"
If, like me, you are using putty to ssh locally on your windows machine to Cygwin as cmd.exe is a terrible console, you may want to change your sshd service to allow it to access the local desktop (this will only work on certain windows flavors) under the sshd windows service Logon properties.
Yes, there is an equivalent to Windows, try with xdg-open <your file>

Resources