Discussion:
How to cmd.exe switches (/U or /A) from INSIDE a DOS batch script?
(too old to reply)
Matt Solob
2008-05-24 07:09:54 UTC
Permalink
Ok, I could set a cmd.exe's switches when calling a batch file by entering

cmd.exe /U mybatchfile.bat

But assume I start with the default /A (ANSI) or just by double clicking on a *.bat file.
Now (after some performed statements) I want to switch output to /U (=Unicode).

Is there a way to set/modify this /U switch from INSIDE a DOS batch script?

Matt
Ted Davis
2008-05-24 17:16:30 UTC
Permalink
This post might be inappropriate. Click to display it.
Tom Lavedas
2008-05-27 13:53:18 UTC
Permalink
Post by Matt Solob
Ok, I could set a cmd.exe's switches when calling a batch file by entering
cmd.exe /U mybatchfile.bat
But assume I start with the default /A (ANSI) or just by double clicking on a *.bat file.
Now (after some performed statements) I want to switch output to /U (=Unicode).
Is there a way to set/modify this /U switch from INSIDE a DOS batch script?
Matt
A reentrant procedure could do it ...

@echo off
if not '%1'=='(#ReenTer$)' %comspec% /u /c %0 (#ReenTer$) %* &&
goto :EOF
shift /2
:: Original procedure goes here ...

The string used to mark reentry is arbitrary. The example uses one
that is unlikely to match any 'real' argument that might be passed.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Loading...