How do I pass the /U switch to the own, current cmd.exe (setup /U as default) ?

  • Thread starter Thread starter Tom Parson
  • Start date Start date
T

Tom Parson

I have a batch file aaa.bat which should be executed by cmd.exe and I want to pass the /U to this cmd.exe.

How do I do this?

Ok, I could open a command prompt and enter

cmd /U aaa.bat

but this is not smart. I want to pass it without opening a first,outer cmd.exe
I want to double click on the batch file and let Win2000 do the rest.

Can I pass it somehow from within the current batch file?

Second question: Can I setup the switch /U as default for the execution of ALL
batch file executions in the future?

Where do I have to enter this switch?

Tom
 
In said:
I have a batch file aaa.bat which should be executed by cmd.exe
and I want to pass the /U to this cmd.exe.

How do I do this?

Ok, I could open a command prompt and enter

cmd /U aaa.bat

but this is not smart. I want to pass it without opening a
first,outer cmd.exe I want to double click on the batch file and
let Win2000 do the rest.

Since you are starting it via shortcut, just alter the executable
spec by placing
CMD.EXE /U /C
in front of the fully qualified path to the .CMD/.BAT file.
This is the easiest.
Can I pass it somehow from within the current batch file?

Sort of. You can use re-entrance and START. Demo below.
There may be a better way...
Second question: Can I setup the switch /U as default for the
execution of ALL batch file executions in the future?

Possibly. But from your posts in that other group I think you can
resolve the characters problem otherwise. Relate your language
setting, Windows character set, CMD codepage...(more?).

Other post:correct. Some of them contain german umlaute.

But when I enter at the command line
dir >filelist.txt
and open the created file with a text editor (e.g. Notepad or others)
the german umlaute (äöü) are replaced by some unreadable characters.
With advice given to use CMD /U which apparently works for the
problem.

Where do I have to enter this switch?

Per Machine or Per User. Suggest per User (your account)

Locate
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
AutoRun=
(REG_SZ)

See http://www.jsiinc.com/
Tips: 2373 3241 6280 7857

= = = u-test.cmd demo cut = = = = = =
@echo off
SETLOCAL
:: U-TEST.CMD (c:\temp\u-test.cmd) (NT5x cmd)
:: Example of pseudo-re-entrance
::
IF %1!==REENTRY! GOTO :MAIN
echo/ Inside U-TEST running in CMD "/A" (default)
pause
START "" /B /W CMD.EXE /U /C c:\temp\u-test.cmd REENTRY
echo/ Returned to first instance
echo/ Leaving U=TEST
pause
EXIT

:MAIN
echo/
echo/ Now running in CMD "/U"
echo/ At :MAIN
pause
echo/ Doing stuff...
echo. EOF reached.
pause

= = = = = = = = = = = = = = = = = = = =
 
@echo off
if exist %temp%\aaa.bat del /q %temp%\aaa.bat
echo @echo off >>%temp%\aaa.bat
echo echo this is a test_1 >>%temp%\aaa.bat
echo echo this is a test_2 >>%temp%\aaa.bat
echo echo this is a test_3 >>%temp%\aaa.bat
echo echo goodby >>%temp%\aaa.bat
start cmd /u | %temp%\aaa.bat
 
I have a batch file aaa.bat which should be executed by
cmd.exe and I want to pass the /U to this cmd.exe.

How do I do this?

Ok, I could open a command prompt and enter

cmd /U aaa.bat

but this is not smart. I want to pass it without opening a
first,outer cmd.exe
I want to double click on the batch file and let Win2000 do
the rest.

Can I pass it somehow from within the current batch file?

Second question: Can I setup the switch /U as default for the
execution of ALL
batch file executions in the future?

Where do I have to enter this switch?

Tom

You could write another batch file to run the batch script with the /u
switch.
 
Back
Top