The MASM Forum

General => The Campus => Topic started by: TouEnMasm on June 27, 2020, 05:19:33 PM

Title: Windows 10 DOS windows
Post by: TouEnMasm on June 27, 2020, 05:19:33 PM
Hello,
Windows 10 allow to open a poweshell window by  shift + right clic on a directory.
I want a dos windows and i find a method writing the registry,code is in the zip.
The cmd is a batch calling  "C:\Windows\System32\cmd.exe %1"
Problem the directory is passed or not , any idea ?
Title: Re: Windows 10 DOS windows
Post by: hutch-- on June 27, 2020, 07:09:21 PM
Yves,

I had a look at the registry file you attached but I don't understand what you are trying to do.

Usually CMD.EXE will give you the default Win10 prompt and from that you can run powershell if you need to.
Title: Re: Windows 10 DOS windows
Post by: TimoVJL on June 27, 2020, 07:14:36 PM
I use this with Windows 7
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\*\shell\Open With cmd\command]
@="\"cmd.exe\" \"/k \"%1\"\""

Title: Re: Windows 10 DOS windows
Post by: Vortex on June 27, 2020, 07:27:48 PM
Hi Timo,

Thanks, that's a nice registry tweaking. Converting the registry entry to a batch file :

Reg.exe add "HKCU\Software\Classes\*\shell\Open With cmd\command" /ve /t REG_SZ /d "\"cmd.exe\" \"/k \"%%1\"\"" /f
Title: Re: Windows 10 DOS windows
Post by: jj2007 on June 27, 2020, 07:45:38 PM
Put it in C:\Users\ToutEnMasm\AppData\Roaming\Microsoft\Windows\SendTo

include \masm32\include\masm32rt.inc
.code
start:
  invoke WinExec, chr$("cmd.exe"), SW_RESTORE
  invoke ExitProcess, 0
end start
Title: Re: Windows 10 DOS windows
Post by: TouEnMasm on June 27, 2020, 08:08:55 PM
After some tests:
Quote
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\CmdPrompt]
@="Command Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\CmdPrompt\command]
@="\"C:\\OpenDosPrompt\" \"%1\""

--------------- batch OpenDosPrompt.bat in c:\----------------------
CD %1
C:\Windows\System32\cmd.exe


And the dos windows open on the directory you have right clic
Title: Re: Windows 10 DOS windows
Post by: Vortex on June 28, 2020, 09:07:22 PM
For Windows XP :

REG ADD "HKCR\Directory\shell\Command Prompt Here\Command" /f /t REG_SZ /ve /d "cmd.exe /k cd %%1"

https://www.trishtech.com/2010/02/add-command-prompt-here-to-right-click-menu-in-windows-xp/