/build/static/layout/Breadcrumb_cap_w.png

Help With Batch File

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

Answers (2)

Posted by: SMal.tmcc 9 years ago
Red Belt
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!



Posted by: clam5917 9 years ago
Senior White Belt
0

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

 

Thanks you

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ