Batch file to query an IP address and amend it

Iain Smart wrote:So a client can have an IP address from any of 4 subnets?Do you have routing between the various subnets? Otherwise how do the clients connect to other internal resources (server, printers etc) that may be on another subnet?It sounds like you need to have some form of failover at the router rather than switching IP address at the client.This way you can leave the internal IP range and the router handles the multiple connections.However, you can use this command to change the IP address (needs admin priviledges):
Batchfilenetsh interface ip set address name=”Local Area Connection” static

Hi Guys,Right, I need to create a batch file which will query the LAN IP address then display what connection it is connected to.So, at one of our sites we have multiple internet connections due to it being in the middle of nowhere and the internet connections are very unstable.We have 2 ADSL connections and 2 4G/3G/2G connections which are all on the same LAN but are seperated by different subnetsSo I need the script to check the IP address and display whether it is on Connection A, B, C or DI will then need the script to ask the user which connection they would like to be on and then it will change the IP to fit the criteria of the subnet they wantThe DNS addresses stay the sameOh and this script will be ran on many different PCs so it needs to check the Local Area Connection and amend it current IP. for example:192.168.3.1 -...
This topic first appeared in the Spiceworks Community

Similar Messages

  • Can't terminate batch file using Ctrl+C in 2003 and 2008server

    Batch file like below:==============================================================@echo off
    set DB_USER=:INPUT_USERNAME
    if "%DB_USER%"=="" (
    set /p DB_USER=Please enter username:
    goto INPUT_USERNAME
    ================================================
    When running this bat file, can't terminate using Ctrl+C in 2003 and 2008 server. But the same bat is running normally in other windows operation system.
    Pls tell me why. Thanks in advance.
    Rocky Su

    I have tested the bat on Windows server 2003 R2 Enterprise x64 Edition SP2 and Windows server 2008 R2 Enterprise.
    Rocky Su

  • Need VB script or Batch file to query Dirty bit

    Hi Friends,
    Could anybody help me in setting up a script which can query Dirty bit on all volumes of 50 servers ?
    Thanks

    Mike / JRV,
    With your help, I could make a script which can find the local drives in a server. But i am blocked to proceed with dirty bit check on those local drives.
    Iam trying my level to find it out :)
    Thanks
    Arun
    You didn't look in the Repository did you?  You also didn't try the code posted above.  We cannot do this for you or would you like someone to remote into your system and do the typing?                     
    fsutil dirty query C:
    ¯\_(ツ)_/¯

  • API method to query multicast address and port of a cluster

    I am new to Tangosol and I'm looking to write a quick Java dashboard that will display current information on our cluster, such as the clustername and the multicast address and port that is being used. Looking at the API I've found the Cluster object and I'm able to get the memeberset and the clustername.But I have not been able to find a way to query the multicast address and port being used by the cluster.
         Any help or links would be appreciated.
         Thanks,
         Len

    Hi Len,
         All this information could be retrieved via JMX. Please see this Wiki page. Detailed documentation about the semantics of all exposed attributes and method could be found in the Javadoc for the <a href ="http://tinyurl.com/r75sy">Registry interface</a>.
         Regards,
         Gene

  • Interactive format IN BATCH FILE CALLING SQL QUERY

    Hi,
    Below code i have written to get some data from file test.txt and O/P the data from database. For this i m running MS-DOS batch file which is calling test.sql and which in turn calls the file test.sql and get desired result from database. The below script works perfectly
    What i want is the more interactive format and not hard coded format esp location and name of the TEXT FILE . How i can make changes that whenever BATCH FILE is run, it ask for file name and location and then passes those information to SQL FILE which in turn fetches the results from database
    BATCH FILE : test.bat
    sqlplus sys/xxxxx as sysdba @test.sqlSQL FILE: test.sql
    SET SERVEROUTPUT ON
    DECLARE
       lc_file_handle        UTL_FILE.file_type;
       lc_file_dir           VARCHAR2 (100);
       lc_file_name          VARCHAR2 (50);
       data                VARCHAR2 (500);
       v1                    ECCSYS.hwcontainer.hwcontainerserialnumber%type;
       v2                    ECCSYS.storagedevice.devicename%type;
       s2                    ECCSYS.storagedevice.isreserved%type;
    BEGIN
       lc_file_dir := 'DATA_PUMP_DIR';
       lc_file_name := 'test.txt';
       lc_file_handle := UTL_FILE.fopen (lc_file_dir, lc_file_name, 'R');
       LOOP
          BEGIN
             UTL_FILE.get_line (lc_file_handle, data);
         v1 := SUBSTR (data,1,INSTR (data, ',', 1) - 1);
         v2 := substr(data, INSTR (data, ',', 1, 1) + 1, length(data) - INSTR (data,',', 1, 1));
           select isreserved into s2 from ECCSYS.storagedevice where devicename=v2 and storagearrayid = (select hwcontainerid from ECCSYS.hwcontainer where hwcontainerserialnumber =v1);
         DBMS_OUTPUT.PUT_LINE(v1 ||' '|| v2 ||' '|| s2);
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                EXIT;
          END;
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          UTL_FILE.fclose (lc_file_handle);
    END;
    EXIT;TEXT FILE : test.txt
    000190300153,170
    000190300153,171

    Hi,
    I have made some changes in the batch and sql file but problem is , still test.sql is seeking name of the file even though its passed from batch file to sql file.
    BATCH FILE : test.bat
    @echo off
    set /P id=Enter THE FILE NAME: %=%
    echo %id%
    sqlplus sys/xxxx as sysdba @test.sql %idSQL FILE : test.sql
    SET SERVEROUTPUT ON
    DECLARE
       lc_file_handle        UTL_FILE.file_type;
       lc_file_dir           VARCHAR2 (100);
       lc_file_name          VARCHAR2 (50);
       data                VARCHAR2 (500);
       v1                    ECCSYS.hwcontainer.hwcontainerserialnumber%type;
       v2                    ECCSYS.storagedevice.devicename%type;
       s2                    ECCSYS.storagedevice.isreserved%type;
    BEGIN
       lc_file_dir := 'DATA_PUMP_DIR';
       lc_file_name := '&id';
       lc_file_handle := UTL_FILE.fopen (lc_file_dir, lc_file_name, 'R');
       LOOP
          BEGIN
             UTL_FILE.get_line (lc_file_handle, data);
         v1 := SUBSTR (data,1,INSTR (data, ',', 1) - 1);
         v2 := substr(data, INSTR (data, ',', 1, 1) + 1, length(data) - INSTR (data,',', 1, 1));
           select isreserved into s2 from ECCSYS.storagedevice where devicename=v2 and storagearrayid = (select hwcontainerid from ECCSYS.hwcontainer where hwcontainerserialnumber =v1);
         DBMS_OUTPUT.PUT_LINE(v1 ||' '|| v2 ||' '|| s2);
          EXCEPTION
             WHEN NO_DATA_FOUND
             THEN
                EXIT;
          END;
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          UTL_FILE.fclose (lc_file_handle);
    END;
    EXIT;

  • Batch File to look at specific location in txt files

    Is there a way to have at batch file look at a specific line and location from a text file and pull it for use in the batch file?  For example, line 1 of sample.txt position ~15,8.
    I'm currently using the Find command(FIND /C "" *.TXT) but would like to be more specific in search.

    From a command line prompt, type 'help set' and look at environment variable expansion. Read the part that says "May also specify substrings for an expansion." It shows an example that uses ~10,5 to start at offset 10 and get the next 5 characters. Of course,
    this means that you will need to you will need to loop through each line. Use the FOR command; type 'help for' and start reading from "Some examples might help." It shows how you can parse a text file:
    FOR /F %%i IN (myfile.txt) do @echo %%i
    In a batch file, use two percent signs. At the command line, use one percent sign. 
    After the 'do' in the FOR command, you can use a CALL :Someprocedurename %%i, which would pass the line from the file into a sub and you can use the SET command to parse it.
    The Help mentions Command Extensions. At command prompt, type 'help setlocal' and read about ENABLEEXTENSIONS. At the bottom of the Help, they give you an example of how to add this to a batch file. You will need this to use the SET command to parse lines
    from the file.
    If you want to save the output, use the redirects, > or >> (create output file or append to output, respectively). Use the same for HELP output: help for > for-help.txt. In your line parser, you would do something more like this:
    [code]
    :ParseLine
    @echo %1 >> outputfile.txt
    exit /b
    GoTo :Eof
    [end code]
    To exit a sub, use either exit /b or goto :eof. Exit will allow you to return a value or error code. Goto :eof simply goes to end of file and returns control to the caller (in our case the FOR command). Of course, you can type 'help exit' to learn more.
    Outside of a subroutine, exit will end the batch file script and return to command prompt. This can be useful when you call this batch file from another script, but if you are starting it from Windows you may want to keep the command prompt open to show user
    the results or simply tell them to look at the output file.
    You can find good samples on Rob Van Der Woude's website.
    http://www.robvanderwoude.com/batchstart.php
    A major geek...

  • Run a batch file from demantra workflow

    I am trying to run a batch file from demantra's workflow by creating an executable step.
    I am getting the following error.
    Error description ’’Invalid command line:’’"D:\Oracle Demantra Spectrum\Collaborator\demantra\sop\populate_staging.bat"
    I am giving the following value in command line of executable step.
    "#application_root#\sop\populate_staging.bat"
    The batch file exists in the appropriate folder.
    Following code is in the batch file.
    sqlldr userid=msdem/msdem@demsbx control=load_item_hier.ctl
    Please help me.
    Thanks

    This should work for you-
    Create a batch file on your current server (ODI) and write in the path to the other batch file on the other server.
    //Server2completename/D$/Path/yourbatchfile.bat
    From ODI call your batch file that you created on the same machine.. which will inturn call the other batch file on a different machine to execute batch client.
    Also can you paste the errors that you may be getting.. need to check if you are getting any specific issue related to this.
    Thanks
    Denzz

  • ESB Process reads a Batch file for a limited set of records only..?

    Dear All,
    I am having an ESB process that reads a Batch file (csv) that has around 10,000 Products information.
    I have another BPEL process that will create the Product in Oracle Apps through standard API (Main BPEL process that calls a child process for creating product).
    I am invoking the BPEL process from ESB, and that works fine.
    Now, the Issue is: I am able to create at a time around 10 Products (the main process calls the child process in a loop.). The main process instance is not getting created but the child process instance is getting created for a set of records, afterwards the child process instances get stops creating. The main process instance could not be found in the console. Not getting why the process is not getting visible as well it is not completing the process.
    What could be the problem for this... Am I need to change any environment configurations...?
    Please update...
    Many Thanks in advance...

    Does this apply to you?
    https://social.technet.microsoft.com/Forums/en-US/9ccd8e50-b0af-4f58-9787-6435834e4c52/dfsr-not-working-on-new-windows-2008r2-server
    Thanks for the link, but no - not the same scenario although the error is the same.   The RGs I'm working with are all in sync and communication is working, it's just getting the backlog reported correctly.
    To reiterate, I can paste two versions of the exact command into the DOS window buffer; one copied from OneNote and one copied from my batch file.  Executing the one from OneNote succeeds and reports the RG in sync and the one copied from the batch
    file fails.
    I can repeat the results by up arrow once to the command pasted into the buffer from the batch file and see it fail.  Then up arrow twice to retrieve the command pasted from OneNote into the buffer and it will report correctly (illustrated in the grahic).
    Let me add that the command in the batch file was originally copied from OneNote and pasted in to the batch file; as if going into the batch file somehow corrupts it.
    - a -

  • Batch file using terminal HEEELLLLPPP

    All i want to do is make a batch file, make it run a .jar file with this command
    java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
    This basical runs the file wich is a server with more ram
    But i have made a batch file and no matter wich command, even (ls) will not work, please someone, i just need a file that will execute commands like a batch file on windows, you click it and it does what ever is in the codes.
    So basicaly, i need it to a find directory using cd then run the command given. but nothing works.

    wiinick100 wrote:
    so my file icon says shell, and it has these lines in it
    #!/bin/bash
    cd desktop
    Even this simple command does nothing, i have also tried ls, and say, and also a bagillion other commands but it only gives me this error
    I do not think you have had enough time to enter a bagillion commands
    Last login: Tue Dec 14 13:04:09 on ttys001
    Imac:~ name$ /Users/lenzini/Desktop/hello.command ; exit;
    /Users/name/Desktop/hello.command: line 1: {rtf1ansiansicpg1252cocoartf1038cocoasubrtf350: command not found
    /Users/name/Desktop/hello.command: line 2: syntax error near unexpected token `}'
    /Users/name/Desktop/hello.command: line 2: `{ onttbl 0 modern charset0 Courier;}'
    logout
    [Process completed]
    whats wrong
    I do not know what is in your hello.command file, but it very much looks like there are lines such as
    {rtf1ansiansicpg1252cocoartf1038cocoasubrtf350
    I do not know what that is doing there, but is is not something the shell knows how to execute.
    I also made a new file, and now its saying i dont have the privileges.
    Did you make the file executable using the "chmod +x filename" command?
    Maybe you could post your script so we can analyze it. When you do this, put it between a pair of tags so that the forum software does not mess with its contents and steal some of the characters as formatting meta-characters
    ... Your script here ...
    {code}

  • Running batch file error

    I have already tried to find some solution on Java Essential forum, not much success there. I hope someone might suggest something here.
    Design: one big file, split into chunks, recombined according to some order, feeded to some exe file, and finally compilation of results.
    Problem: I can run that smoothly with jdk, however, when I use Java beans I am running into troubles. I can split the file, create an order, recombine the files, but when I try to feed it to an exe file(through a batch file) i get this error:
    endfile record was detected in a READ statement (UNIT = 3). Error occurs at _MAIN__. A dubplicate file name exists or the file cannot be foundThe main method is something like this:
            s.split_ftn07() ;
            s.Define_Order() ;
            for (int i = 1 ; i < 11 ; i ++)
                s.re_combine(i) ;
                s.run_Fastran(i) ;
            s.ass_Result() ;my batch file:
    @echo off
    cd
    "C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
    ren FTN04 FTN04i
    :finishand my method that runs the batch file: (as soon as it pass the exec(), it opens the cmd.exe windows and displays the error message).
    public void run_Fastran(int x)
           try
               File ftn07_i = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               File ftn07 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
               ftn07_i.renameTo(ftn07) ;
               String path = "";
               path = "cmd /c start C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FCall.bat";
               Runtime rt = Runtime.getRuntime();
               Process proc = rt.exec(path);
               String nameNew = "C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04-" + x + "-p12";//change p12 with the crack path input by user.
               File file = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04i");
               while (file.exists()==false)//until FTNO4i come into existence
                // File with new name
               File file2 = new File(nameNew);
                // Rename file
               file.renameTo(file2);
               File ftn07Back = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
               File ftn07_iBack = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               ftn07Back.renameTo(ftn07_iBack) ;
               File ftn07_i_del = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
               ftn07_i_del.delete() ;
           catch(Exception e)
               e.printStackTrace();
        }I am tired to figure out whats going on? Need some help here, will be greatly appreciated. Thanks

    Thanks to all, I really appreciate all the pains which all of you have taken in resolving my problem.
    It wasn't Java problem, rather batch file problem. I was only changing the directory, and was not providing for the exe file to run.
    @echo off
    cd  "C:\JBoss\jboss-4.0.5.GA\bin\Fastran"
    "C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
    ren FTN04 FTN04i
    EXIT
    :finishNow it is working fine.
    I did check the access permissions, no problem with that I guess. The problem was with the path. The batch file couldnt go pass bin directory, and I noticed that only today ;(. At any rate, I changed that and now it is all smooth and dandy.
    Once again, thanks a lot.

  • Call procedure from batch-file

    Hello,
    I want to write a batch-file which call a stored procedure and deletes a file in a directory.
    I wrote in my batch-file this. But it doesn't work.
    SQLPLUS scott/tiger@ proc
    del c:\test.txt

    You put the space on the wrong place.
    Try this:
    SQLPLUS scott/tiger @proc
    del c:\test.txt

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • Run batch file on a remote computer

    I am looking for syntax so that I can run a batch file that is on my computer and I want to run it on a remote computer. I am thinking I can do this with psexec but have not been able to figure out the correct syntax.

    psexec.exe -s \\namepc -u yourusername -p yourpassword cmd /k c:\blabla\Install.bat
    Install.bat must be on some folder on remote pc and I think that is only posible way.
    U can change \\namepc with @blabla.txt file with computers list if you want to run that bat file on more computers.
    Your account in this example must have admin rights on remote computer.

  • Placing image icon on top of batch file

    i am creating a batch file , now i want to place application specific icon on top of that file , so how can i do it through my code
    File batchFile = new File(installationDirectory+ "\\"+ "QTL.bat");
    fos = new FileOutputStream(batchFile);
    DataOutputStream dos=new DataOutputStream(fos);
    dos.writeBytes("set JAVA_HOME="+ "\""+ javaHome+ "\"" +"\n");
    dos.writeBytes("set QTL_HOME="+ installationDirectory+ "\n");
    dos.writeBytes("cd %QTL_HOME%"+ "\n");
    Regards

    >
    i am creating a batch file , now i want to place application specific icon on top of that file , so how can i do it through my code
    >
    You can't - a batch file doesn't have an Icon or a place to store one.
    On Windows you can specify the icon for a shortcut.
    1. create a shortcut on the desktop to the batch file
    2. right-click the shortcut and select 'Change Icon
    3. select your icon from the available list or point to another DLL that has the icon you want to use.
    The only way to do the above programatically is to use the Win API to programatically create the shortcut and do it.

  • Alternate Shell with specified batch file

    Hi there,
    I've created a set of scripts for my computer lab which, per a scheduled task, reboots the computer into safeboot with the alternate shell enabled (via bcdedit). It also sets the machine to auto-login (via registry keys).
    Then it runs a couple of malware scans, and whatever other clean-up tasks I want.
    Now, I'm wanting to pass a script to be executed by the cmd.exe shell (i.e. the 'alternate' shell), but it seems no matter what syntax I use, it doesn't want to parse anything after the cmd.exe in the registry.
    e.g.
    batch file syntax, with executable in QMs and parameters un-quoted:
    HKLM\System\CurrentControlSet\Control\SafeBoot\AlternateShell : "cmd.exe" /C C:\labUtilities\***.bat
    Fully-quoted:
    HKLM\System\CurrentControlSet\Control\SafeBoot\AlternateShell : "cmd.exe /C C:\labUtilities\***.bat"
    Fully un-quoted:
    HKLM\System\CurrentControlSet\Control\SafeBoot\AlternateShell : cmd.exe /C C:\labUtilities\***.bat
    Does anyone have experience with passing parameters to via the AlternateShell key?
    I know for a fact this is possible, as I've seen it done by malware; I just can't remember the syntax it used.
    Thank you!

    i think it should be:
    CMD /c "C:\labUtilities\***.bat" under normal circumstances, not sure if this will work out of the registry.
    source: http://ss64.com/nt/cmd.html
    Kind regards, Philipp - Solid IT Solutions

Maybe you are looking for