Jump to content











Photo
- - - - -

Clear command prompt history Windows 10 2004

command prompt cmd; history

  • Please log in to reply
6 replies to this topic

#1 guimenez

guimenez

    Frequent Member

  • Advanced user
  • 172 posts
  •  
    Portugal

Posted 31 December 2021 - 05:27 PM

Hi.

I'm unable to clear the Command Prompt history in WinPE Windows 10 2004 version.

I'm using doskey do create menus and i've used the command doskey /listsize=0 and it's not working now.

Any Ideas?

Thank you.



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 January 2022 - 09:50 AM

Isn't /REINSTALL used to clear buffer? :unsure:

 

https://ss64.com/nt/doskey.html

 

Or ALT+F7?

 

:duff:

Wonko



#3 guimenez

guimenez

    Frequent Member

  • Advanced user
  • 172 posts
  •  
    Portugal

Posted 01 January 2022 - 12:27 PM

Isn't /REINSTALL used to clear buffer? :unsure:

 

https://ss64.com/nt/doskey.html

 

Or ALT+F7?

 

:duff:

Wonko

 

Thanks for replying Wonko and have a greate happy new year :)

 

I'm refreshing my WinPE with latest Windows 10 version based.

I've build my menu with doskey on the file startnet.cmd (the first batch file WinPE open).

After opening any program and closing it (at the end and trying to use doskey /reinstall) it reboot WinPE since the reinstall command kill the startnet.cmd and WinPE always boot after that file is closed.

ALT+F7 works but it's not good, because i need to press ALT+F7 everytime i open a new menu (i've 7 menus).

I've tried ALT+F7 with SendKeys but it doesn't work.

Here is my example:

var wshShell = WScript.CreateObject("WScript.Shell"),
    envVar = wshShell.Environment("Process"),
    numOpts = parseInt(envVar("numOpts"));

if ( WScript.Arguments.Length ) {
   // Enter menu options
   wshShell.SendKeys("%{F7}");  //clear the doskey and not working
   for ( var i=1; i <= numOpts; i++ ) {
      wshShell.SendKeys(envVar("option["+i+"]")+"{ENTER}");
   }
} else {
   // Enter a F7 to open the menu
   wshShell.SendKeys("{F7}");
}

Thank you



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 January 2022 - 02:02 PM

Then maybe it is a problem with VB Sendkeys? (what you posted seems just fine, but you never know).

 

Try using (for a test) either AutoIt, AutoHotKey or - probably easier/faster - nircmd:

http://www.nirsoft.n...ils/nircmd.html

https://nircmd.nirso...et/sendkey.html

or Sendkeys.exe:

https://www.softspec...lutilities/list

https://www.softspec...es/SendKeys.htm

 

This way you can maybe confirm that it is an issue with the VB code (it is also possible that - for whatever reasons - ALT+F7 is not trappable :dubbio: )

 

:duff:

Wonko



#5 guimenez

guimenez

    Frequent Member

  • Advanced user
  • 172 posts
  •  
    Portugal

Posted 01 January 2022 - 06:17 PM

Then maybe it is a problem with VB Sendkeys? (what you posted seems just fine, but you never know).

 

Try using (for a test) either AutoIt, AutoHotKey or - probably easier/faster - nircmd:

http://www.nirsoft.n...ils/nircmd.html

https://nircmd.nirso...et/sendkey.html

or Sendkeys.exe:

https://www.softspec...lutilities/list

https://www.softspec...es/SendKeys.htm

 

This way you can maybe confirm that it is an issue with the VB code (it is also possible that - for whatever reasons - ALT+F7 is not trappable :dubbio: )

 

:duff:

Wonko

 

I think ALT+F7 it's not trappable :(

I've tested with both apps and it doesn't work.

Another problem with sendkeys it's the FN. If enable, F7 will not work has espected, and with notebooks it will be a problem  :(



#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 January 2022 - 11:06 AM

Hmmm. :(

 

Maybe using a spawned secondary cmd.exe spawned from startnet.cmd?

 

But it would need to automatically restart this secondary instance, and then it may become difficult to actually exit/shutdown the PE.

 

It is a lot of time I played with doskey but it is tricky and largely un- or mis- documented, and it is entirely possible that what worked on older cmd.exe does not work anymore on stupid Windows 10.

 

Sendkeys.exe "Prompt dei comandi" %{F7}

does work just fine on my (italian) XP.

 

Very likely NOT useful in any way in your specific case, only as an example of "lost knowledge":

https://web.archive....i/Doskey_Macros

 

:duff:

Wonko



#7 guimenez

guimenez

    Frequent Member

  • Advanced user
  • 172 posts
  •  
    Portugal

Posted 03 January 2022 - 11:05 AM

Thanks Wonko.

I've tried spawned old cmd.exe and even replace default cmd from WinPE with old cmd and doskey but it's the same :(

I think i will stay with WinPE 1803 (latest working).

Thanks in advance  :thumbsup:

 

Guimenez






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users