Jump to content

How to cmd.exe switches (/U or /A) from INSIDE a DOS batch script?


Recommended Posts

Guest Matt Solob
Posted

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

  • Replies 1
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: How to cmd.exe switches (/U or /A) from INSIDE a DOS batch script?

 

 

"Matt Solob" <msolob@hotmail.com> wrote in message

news:4837bf42$0$6558$9b4e6d93@newsspool3.arcor-online.net...

> 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

>

 

You need to invoke another instance of the Command Processor,

e.g. like so:

@echo off

if /i "%1"=="Unicode" goto action

echo Primary processor

cmd.exe /u /c %0 Unicode

goto :eof

 

:Action

echo Secondary processor

dir c:\

{Your other batch file commands go here}

 

By the way, DOS is an operating system introduced some thirty

years ago. It is now considered a legacy OS and is only rarely

used. DOS did not understand switches such as /U or /A. The

example I gave above is a batch file, not a DOS batch script.


×
×
  • Create New...