Good day,
new to Dos and batch files programming and have tried to figure this out without any luck.
I'm trying to run a batch file to open a dos command window (show it in Windows) and then have a pause. Once the keyboard is pressed change the directory to C:\Program Files (x86)\Symantec\Symantec Endpoint Protection showing the directory and then press the pause to exit.
This is what I have which doesn't work 100%. It opens two DOS windows one with the below and another one C:\Windows\system32>
start cmd.exe
pause
cd "C:\Program Files (x86)\Symantec\Symantec Endpoint Protection"
pause
Batch command
Moderator: DosItHelp
Re: Batch command
Batch is an interpreter language, which means that the interpreter is always loaded (which under windows typically is cmd.exe).
So, maybe your batch file but leaving out the first line ("start cmd.exe") is, what you are looking for.
penpen
So, maybe your batch file but leaving out the first line ("start cmd.exe") is, what you are looking for.
penpen
Re: Batch command
This would do the trick:
Hang on, never mind, didn't read the post itself well and the first reply which answers it already.
Must be getting late for me
Code: Select all
@echo off
pause
for %%b in ("C:\Program Files (x86)\Symantec\Symantec Endpoint Protection") do (
start "Contents of Symantec Endpoint Protection" /wait "cmd" "/d /k dir /p /on "%%~sfb" & pause & exit
)
pause
exit /b
Must be getting late for me