i have a shortcut to cmd.exe.
Is it possible to change cmd window title when I run it from this shortcut ?
C:\> cmd /k "title MyWindow"
`cmd /K` => Carries out the command specified by string but remains
`title [str]` => Specifies the title for the command prompt window.
I don't think this is possible. You will need to create a shortcut to a batch file that run cmd.exe with your custom window title, something like this:
start "MyWindow" cmd.exe
This works when launching from a CMD script
(launches CMD in specific user context with a specific title)
runas /savecred /user:domain\user "%SystemRoot%\system32\cmd.exe /K title BAD MF"
Related
I am running Windows 7 and when I run cmd.exe I want it to start up
in a directory named C:\foo\bar. I remember being able to create a
link to this executable on the desktop and right clicking somewhere
to set the startup menu of the cmd.exe command prompt by filling
out a field in a transient window, but I cannot find it. I have
found the following argument which however seems more complicated.
I want to set the startup directory for cmd.exe via a popup window.
Changing default startup directory for command prompt in Windows 7
Any ideas?
as mentioned by the other posters already:
the regular approach is to edit the shortcut's properties and fill the field labled "start in". simple as that.
however, for some reason this has no effect on UAC enabled systems if at the same time you also enable the "run as administrator" checkbox in the advanced properties of the shortcut.
a solution is to put everything in the "target" field of the shortcut:
%windir%\System32\cmd.exe /K cd /d "E:\My Folder" & sometest.bat
when running on 64bit and you want to explicitly start the 32bit flavour of the command prompt:
%windir%\SysWOW64\cmd.exe /K cd /d "E:\My Folder" & sometest.bat
for additional information on the command line parameters used above see:
cmd.exe /?
cd.exe /?
When you create a shortcut to cmd.exe, you can open the shortcut properties and find under Shortcut tab the Starts in option that will tell cmd.exe where to start, like here:
Open the properties of a shortcut to cmd and set the directory there:
Try this Shortcut Target:
C:\Windows\System32\cmd.exe cd /d %~dp0
Which will start cmd.exe in the shortcut's folder.
I found PowerCmd. And would like to substiture cmd - as default IDE for execution of bat files.
But simple replacin of comspec do nothing.
I cann't also rename cmd.exe in %SYSTEM32%.
Is possible to substiture or not?
Thanks.
I am giving answer for Powershell, should be similar for anything else that you want to use:
Use Regedit and goto
HKEY_CLASSES_ROOT\batfile\shell\open\command
Set the default value to
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit "%1" %*
Now when you double click on any batch file, it should run on powershell. -noexit gets to the powershell prompt after completion of the batch file.
I am testing out batch files and I am trying to launch notepad.exe but without any success.
test.bat:
#echo off
START /MAX "C:\Windows\system32\notepad.exe"
the only thing that happens is that a new command prompt window opens up with "C:\Windows\system32\notepad.exe" as its title.
any ideas on what is going on?
CMD's silly parsing goes on :)
Remove the "" and CMD won't assume you try to set the title of the new window.
Or, use:
START /MAX "" "C:\Windows\system32\notepad.exe"
You can just call ...
#echo off
C:\Windows\system32\notepad.exe
what about just
#echo off
"C:\Windows\system32\notepad.exe"
If you have your command like this then it opens a notepad maximized: (no double quotes)
START /MAX C:\Windows\system32\notepad.exe
does anyone know if there is a way (programatically or not) to open up a windows command prompt window and pre-populate it with text?
Run CMD.EXE /K ECHO The Text
Create a batchfile (.bat) that uses the type command, then open that:
echo "Hello World"
echo "Insert junk here"
cmd.exe
anybody know how to minimize the command prompt when running a batch script in Windows 3.11?
in Windows XP, there have a command
start /min start.bat
to minimize the cmd prompt, is it have similiar command in MSDos 6.22?
This little batch code should do what you need.
http://zoombody.com/articles/run-a-batch-script-minimized
The relevant code then needs to be placed at the top of your script:
if not "%minimized%"=="" goto :minimized
set minimized=true
start /min cmd /C "%~dpnx0"
goto :EOF
:minimized
rem Anything after here will run in a minimized window
Here is more information about "%~dpnx0".
There isn't a command that you can use from a DOS prompt, however you can create a PIF file that points to your batch file, in which you can set the default window position (including minimized).
...I think. It's been a couple of decades.
How to minimize the current command prompt:
Purpose:
Close a command prompt after execution.
Open a new command prompt using the same path.
First open command prompt :
Hold down the [Windows] + [R] keys.
Go to this location:
C:\>cd Users\Admin\Desktop
Next excute:
C:\Users\Admin\Desktop>start /min && exit
Results:
A new minimized command prompt should open with the same path.
Alternatively:
Create a script named minimize.bat and type start /min && exit into the script and place it in your system32 folder. In order to have the ability to access it via the command prompt.
Windows 10 makes it very easy to start minimized. Simply create a shortcut and click properties. On the shortcut tab half way down is the "Run:" option witch lets you select how you want the command line window to start up. Just select minimized and your command window will remain minimized from the onset.
Windows10 properties window of a shortcut
Use WinExec to start your batch file and pass SW_SHOWMINIMIZED for the second parameter.
See also, How do I run a batch file with WinExec?