How to AUTOMATICALLY prepend/pass a "/U" switch to cmd.exe when executing a *.bat batch file ?

T

Thommy Kanther

When a batch file should create Unicode output then a /U switch must be used for
the processing cmd.exe. So I could execute a batch with

cmd.exe /U mybatchfile.bat

That works for the. moment.

However when I doubleclick a .bat file I have no possibility to pass the /U flag.

How do I specify that every time I execute a .bat by doubleclicking the /U should be
automatically taken? I don't want to create a second shortcut.

As a workaround I could accept that the /U flag is not only used for a particular batch file
e.g. mybatchfile.bat but for ALL my batch files.

When I right click on the properties of C:\WINDOWS\system32\cmd.exe I found no entry field
for entering this parameter. Can I specify it in the Registry ?

Thommy
 
P

Pegasus \(MVP\)

Thommy Kanther said:
When a batch file should create Unicode output then a /U switch must be used for
the processing cmd.exe. So I could execute a batch with

cmd.exe /U mybatchfile.bat

That works for the. moment.

However when I doubleclick a .bat file I have no possibility to pass the /U flag.

How do I specify that every time I execute a .bat by doubleclicking the /U should be
automatically taken? I don't want to create a second shortcut.

As a workaround I could accept that the /U flag is not only used for a particular batch file
e.g. mybatchfile.bat but for ALL my batch files.

When I right click on the properties of C:\WINDOWS\system32\cmd.exe I found no entry field
for entering this parameter. Can I specify it in the Registry ?

Thommy

Instead of getting your shortcut to invoke the batch file, get it to
invoke this command line:

%windir%\system32\cmd.exe /u /c c:\temp\test.bat
 
R

Rock

Thommy Kanther said:
When a batch file should create Unicode output then a /U switch must be
used for
the processing cmd.exe. So I could execute a batch with

cmd.exe /U mybatchfile.bat

That works for the. moment.

However when I doubleclick a .bat file I have no possibility to pass the
/U flag.

How do I specify that every time I execute a .bat by doubleclicking the /U
should be
automatically taken? I don't want to create a second shortcut.

As a workaround I could accept that the /U flag is not only used for a
particular batch file
e.g. mybatchfile.bat but for ALL my batch files.

When I right click on the properties of C:\WINDOWS\system32\cmd.exe I
found no entry field
for entering this parameter. Can I specify it in the Registry ?

Didn't you just ask this question? This is a peer to peer newsgroup.
Everyone here is a volunteer and it can take 24-48 hrs for someone who might
know the answer to see and respond. So best not to be reposting the same
question right away. If you can't find your previous post search for it
using Google Groups Advanced Search.

http://groups.google.com/advanced_search?q=&ie=UTF-8&oe=UTF-8&hl=en
 
A

Ayush

Thommy Kanther wrote ::
When a batch file should create Unicode output then a /U switch must be used for
the processing cmd.exe. So I could execute a batch with

cmd.exe /U mybatchfile.bat
How do I specify that every time I execute a .bat by doubleclicking the /U should be
automatically taken? I don't want to create a second shortcut.

Open Registry Editor.
Open this key-
HKEY_CLASSES_ROOT\batfile\shell\open\command
Right side, change the value to:
CMD.exe /c /U "%1" %*


Good Luck, Ayush.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top