C:\_G\WWW\~ELISANET\INFO\tscmd128.html
<http://www.elisanet.fi/tsalmi/info/tscmd128.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Mon 5-Nov-2018 11:25:02

 
Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
 

This page is edited from the 1cmdfaq.txt faq-file contained in my tscmd.zip command line interface (CLI) collection. That zipped file has much additional material, including a number of detached .cmd script files. It is recommended that you also get the zipped version as a companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



128} How to prevent SET /P input from entering the command history?

  @echo off & setlocal enableextensions
  set cmdfile=C:\_M\TEMP\temp$$$.cmd
  >  "%cmdfile%" echo @echo off
  >> "%cmdfile%" echo set /p var_="Give your input? "
  >> "%cmdfile%" echo echo %%var_%%
  for %%c in ("cmd /c" del) do %%c "%cmdfile%"
  endlocal & goto :EOF

Output
  C:\_D\TEST>cmdfaq
  Give your input? Hello World
  Hello World
The "Hello World" is not in the command history.

Or use a call like
  CMD /C myscript.cmd

Incidentally, the first option could also be formulated as
  @echo off & setlocal enableextensions
  set cmdfile=C:\_M\TEMP\temp$$$.cmd
  (
    echo @echo off
    echo set /p var_="Give your input? "
    echo echo %%var_%%
  )> "%cmdfile%"
  for %%c in ("cmd /c" del) do %%c "%cmdfile%"
  endlocal & goto :EOF

References/Comments: (If a Google message link fails try the links within the brackets.)
  Google Groups Jan 7 2006, 6:03 pm [M]

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd128.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd128
http://www.elisanet.fi/tsalmi/info/tscmd128.html
file:///c:/_g/www/~elisanet/info/tscmd128.html