I am not good with batch file and need your help.  I have current login script to install SCCM 2012 with these rules that somone on our team created but now he is out of the office for the next 2 weeks.  I can't wait that long.

    If exist %windir%\ccmsetup\ccmsetup.exe GOTO %AVSrvr%
    If exist %windir%\system32\ccmsetup\ccmsetup.exe GOTO %AVSrvr%
    If exist %windir%\CCM\CcmEval.exe GOTO %AVSrvr%
    if %location%==VPN set location=HQDT
    if %location%==Unknown set location=HQDT
    if %location%==EUVPN set location=UK
    Echo Please wait while SCCM 2012 is installing. This may take 2-4 minutes...
    \\netapp-%location%\apps\sccm\SCCM_2012_Client\Install_SCCM_2012.exe
    echo SCCM 2012 Client installation has finished...
    goto %AVSrvr%

 

Is there a command that say "If this file (ccmsetup.exe) is running" goto %AVSrvr%? 

 

Thanks,

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0
you should be able to use this answer to create the code to do that

http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_27848083.html

Verified Answer

2012-08-30 at 08:54:57ID: 38350976

This one starts the browser if the process is not found, and makes sure that only the user's processes are queried:
@echo offsetlocaltasklist.exe /FI "IMAGENAME eq CPOPM06.exe" /FI "USERNAME eq %UserName%" | find /i "CPOPM06.exe" >NULif errorlevel 1 (	set ProcExists=NO) else (	set ProcExists=YES)if /i "%ProcExists%"=="NO" (	start http://servername/centricityps)                                          
1:2:3:4:5:6:7:8:9:10:11:

Select allOpen in new window

 

Assisted Solution

Merrell2012-08-30 at 08:59:08ID: 38351007

I figured it out:


@echo on
 
tasklist /FI "USERNAME ne NT domain\%username%" /FI "STATUS eq running" /FI "IMAGENAME eq CPOPM06.exe" | find /i "CPOPM06.exe" && set PROCEXIST=YES
 
IF ERRORLEVEL 2 GOTO FoundCPS
IF ERRORLEVEL 1 GOTO StartCPS
 
:FoundCPS
goto EXIT
 
:StartCPS
start http://servername/centricityps/cps/
goto EXIT
 
:EXIT
Exit
 

Author Closing Comment

Merrell2012-09-04 at 02:17:41ID: 38362890

Both scripts accomplish the goal!



Answered 01/30/2015 by: SMal.tmcc
Red Belt

Please log in to comment
0

Thank you for your prompt reply.  I will try these out and will get back to you soon.

 

Thanks you

Answered 01/30/2015 by: clam5917
Senior White Belt

Please log in to comment
Answer this question or Comment on this question for clarity