#1 28 Dec 2018 14:00

Rekrul
Member
Registered: 17 Apr 2016
Posts: 12

The Choice command in Windows XP

I suspect this question will probably go unanswered, but I figured I might as well ask...

For some insane reason, Microsoft decided to omit the Choice command from Windows NT/XP. Apparently it was later available in some sort of resource kit, which I don't have.

I did download a Choice command that works on XP, but it uses a slightly different syntax to that of the Choice command in later versions of Windows. I got it from here;

https://sourceforge.net/projects/vbsmc/files/Resources/

The following works in XP, but not in Win7/8/10;

choice /c1234 Please choose [1-4]: /n

The following works in Win7/8/10, but not XP;

choice /c 1234 /m "Please choose [1-4]:" /n

Is there a version of the Choice command available for XP that will accept the same syntax as used by the Win7/8/10 version?

It would be nice if I didn't have to write two different versions of scripts just to make them compatible across Windows versions.

Offline

#2 28 Dec 2018 17:14

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 980
Website

Re: The Choice command in Windows XP

Why not use SET /P instead?

Alternatively detect the OS with the VER command and then run one of the two choice commands.

Offline

Board footer

Powered by FluxBB