windows - Put editable text in command prompt with bat file -


i have bat script asks user input next line

set /p returnstring=enter string: %=% 

now want default input visible on command line, like:

enter string: defaultstring 

to clarify: don't want default value if no input given, want default value visible , editable on command line, in case described above defaultstring replaced different text.

is possible set in batch file? if not, how accomplish this?

here batch + jscript hybrid script prompts default value.

@if (@codesection == @batch) @then  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: first line in script is... :: in batch, valid if command nothing. :: in jscript, conditional compilation if statement false. ::             following section omitted until next "[at]end". :: note: "[at]then" required batch prevent syntax error. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: batch section  @echo off setlocal set "input=" set "default=hello world" title myuniquetitle cscript //e:jscript //nologo "%~f0" "myuniquetitle" "%default%" set /p "input=> prompt: " if defined input set "input=%input:"=%" echo(%input% endlocal exit /b 0  :: end of batch :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @end //////////////////////////////////////////////////////////////////////////////// // jscript section  try {     var wshshell = wscript.createobject('wscript.shell');     var title = wscript.arguments.item(0);     var message = wscript.arguments.item(1);     wshshell.appactivate(title);     wshshell.sendkeys(message);     wscript.quit(0); } catch(e) {     wscript.echo(e);     wscript.quit(1); } wscript.quit(2); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -