0

Is it possible not to retype whole string variable if I want to change just a few characters in it.

set "var=This is a very long string up to 200 characters..... etc . etc....."
set /p "var=var? "

I have to retype all

I need something like below

Output
var=This is a very long string up to 200 characters..... etc . etc..... 
and using left and right arrows to change it. Enter when done.   
Mofi
  • 46,139
  • 17
  • 80
  • 143
  • There are workarounds but we'd have to know how the string is being entered and how the batch file is being used. `Aacini` wrote a VBS enhanced script that can help you in the way you have mentioned IIRC, but I don't recall if it was posted here or at Dostips.com forum. – foxidrive Sep 18 '14 at 14:46
  • @foxidrive: This is the link: http://stackoverflow.com/questions/23619510/input-with-a-default-editable-string-in-a-bat-by-using-powershell/23622808#23622808 – Aacini Sep 20 '14 at 04:20

1 Answers1

0

Below there is a Batch-JScript hybrid script that do what you want:

@if (@CodeSection == @Batch) @then

@echo off
set "var=This is a very long string up to 200 characters..... etc . etc....."
CScript //nologo //E:JScript "%~F0" "%var%"
set /P "var=var? "
echo var=%var%
goto :EOF

@end

WScript.CreateObject("WScript.Shell").SendKeys(WScript.Arguments(0));
Aacini
  • 65,180
  • 12
  • 72
  • 108