Note that there are some explanatory texts on larger screens.

plurals
  1. POBatch Error - "this process cannot be access because the file is being used by another process"
    primarykey
    data
    text
    <p>I am trying to run a file in order to grab the IP after I ping a list of host file names.</p> <p>When I try to run it I get the error that "this process cannot be access because the file is being used by another process"</p> <p>What can I do to fix it?</p> <pre><code>@ECHO OFF COLOR 1f :HEADER CLS ECHO ------------------------------------------------------------------------------- ECHO AUTHOR: Levon Becker ECHO TITLE: Ping-List ECHO LAST CHANGE: 04/08/2010 ECHO VERSION: 1.002 ECHO LINK: http://wiki.bonusbits.com/main/BatchScripts:Ping_List ECHO ------------------------------------------------------------------------------- ECHO. PAUSE :NOTES REM +The text file with your list of hostnames should be named hostlist.txt REM +The hostnames can be seperated by a comma or carriage return REM +The output file will be a text file named PingResults.txt REM +The output file is setup to be comma delimited for easy import to Excel REM +Changed output file to be csv REM Delete the output file if it exists from a previous run. IF EXIST "PingResults.txt" del /q PingResults.txt REM Delete the temp file. IF EXIST "pinglog" del /q pinglog REM Description Header for top row in Excel ECHO Hostname,IP from Ping,Ping Status,Data of Ping,Time of Ping &gt; PingResults.csv REM Pull hostnames from text file until the end of the text file list for /f "tokens=* delims=," %%I in (hostlist.txt) do call :sub1 %%I goto :eof :sub1 REM Display in the command window which hostname is being processed so we know REM something is happening. ECHO %1 REM Ping the current hostname set as %1 and redirect the output to pinglog file. ping -a -n 1 -w 500 %1 &gt; pinglog PAUSE SET status=UNKNOWN find /i "unknown host" &lt; pinglog &gt; nul if not errorlevel 1 set status=UNKNOWN HOST find /i "could not find host" &lt; pinglog &gt; nul if not errorlevel 1 set status=HOST NOT FOUND find /i "reply" &lt; pinglog &gt; nul if not errorlevel 1 set status=UP find /i "expired in transit" &lt; pinglog &gt; nul if not errorlevel 1 set status=EXPIRED IN TRANSIT find /i "Request timed out" &lt; pinglog &gt; nul if not errorlevel 1 set status=DOWN PAUSE SET PINGIP=NO IP REM Pull the IP address of the line that has Pinging in it and IP between [] FOR /F "tokens=1,2 delims=[]" %%A IN ('FIND "Pinging" pinglog') DO IF NOT "%%B"=="" SET PINGIP=%%B REM Append line of gathered information including the hostname from the source. REM No spaces so it falls into Excel easier &gt;&gt; PingResults.csv echo %*,%PINGIP%,%status%,%DATE%,%TIME% REM Delete the temp file. IF EXIST "pinglog" del /q pinglog PAUSE goto :eof COLOR 1a CLS ECHO. ECHO ********************************************* ECHO ********************************************* ECHO ** ** ECHO ** PROCESS COMPLETED! ** ECHO ** ** ECHO ** The Output Filename is PingResults.txt ** ECHO ** ** ECHO ********************************************* ECHO ********************************************* ECHO. ECHO. PAUSE :END exit </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload