Tom Parson
09-24-2005, 05:45 PM
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
Mark V
09-24-2005, 07:57 PM
In microsoft.public.win2000.cmdprompt.admin Tom Parson wrote:
> 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:
>>>> everything is fine. All files with their filenames are listed
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
= = = = = = = = = = = = = = = = = = = =
Royce
09-24-2005, 08:59 PM
@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
"Tom Parson" wrote:
> 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
>
>
Sparda
09-25-2005, 06:36 PM
"" wrote:
> 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.
--
Posted using the http://www.windowsforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.windowsforumz.com/General-Discussion-pass-switch-current-cmd.exe-setup-default-ftopict425113.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.windowsforumz.com/eform.php?p=1423472