Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: help with some things in dos  (Read 9954 times)

0 Members and 1 Guest are viewing this topic.

get2500

    Topic Starter


    Greenhorn

    help with some things in dos
    « on: September 14, 2009, 05:24:40 PM »
    im trying to make a batch file search for and execute a java HTML file for the applet viewer. all im missing is the command to search and execute a file when found. if someone could help me it would be appreciated.

    thxx

    billrich

    • Guest
    Re: help with some things in dos
    « Reply #1 on: September 14, 2009, 06:21:23 PM »
    ?
    « Last Edit: September 17, 2009, 12:49:33 PM by billrich »

    get2500

      Topic Starter


      Greenhorn

      Re: help with some things in dos
      « Reply #2 on: September 14, 2009, 06:22:54 PM »
      yes but how do you copy the directory that it gives you so that you can change directories so you can tell it to run the file

      billrich

      • Guest
      Re: help with some things in dos
      « Reply #3 on: September 14, 2009, 06:45:37 PM »
      Is the  java HTML  on your machine or some where on the internet?

      http://www.cs.colostate.edu/helpdocs/JavaInDOS.html


      get2500

        Topic Starter


        Greenhorn

        Re: help with some things in dos
        « Reply #4 on: September 14, 2009, 07:07:32 PM »
        on the machine but i need it to search the computer for the file then change the directory to where its located

        billrich

        • Guest
        Re: help with some things in dos
        « Reply #5 on: September 14, 2009, 07:49:55 PM »

        C:\>cd \

        use *.htm  if you do not know the name of the file

        C:\>dir /s timezone.htm
         Volume in drive C has no label.
         Volume Serial Number is F4A3-D6B3

         Directory of C:\WINDOWS\system32\oobe\setup

        04/14/2008  07:00 AM             3,099 timezone.htm
                       1 File(s)          3,099 bytes

             Total Files Listed:
                       1 File(s)          3,099 bytes
                       0 Dir(s)  307,248,930,816 bytes free

        C:\>cd  C:\WINDOWS\system32\oobe\setup

        C:\WINDOWS\system32\oobe\setup>dir timezone.htm
         Volume in drive C has no label.
         Volume Serial Number is F4A3-D6B3

         Directory of C:\WINDOWS\system32\oobe\setup

        04/14/2008  07:00 AM             3,099 timezone.htm
                       1 File(s)          3,099 bytes
                       0 Dir(s)  307,249,434,624 bytes free

        C:\WINDOWS\system32\oobe\setup>

        get2500

          Topic Starter


          Greenhorn

          Re: help with some things in dos
          « Reply #6 on: September 16, 2009, 09:07:25 PM »
          ya but im running a batch file so how do i get it to put that directory that it found into a directory change on its own

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #7 on: September 17, 2009, 04:02:35 AM »
          yes, but I'm running a batch file so how do I get it to put that directory that it found into a directory change on its own.

          Each program ( or command ) that is typed at the command prompt may be placed in a batch file and each line will execute as if you typed at the program at  the  command prompt.

          Any program will execute if you show the complete path to the program. You need  not CD to the folder containing the program. Either method can be used. It does not hurt to CD to the folder (directory ) containing the program.

          Once the location of the program is known, the search for the program is not required each time.

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: help with some things in dos
          « Reply #8 on: September 17, 2009, 04:29:33 AM »
          Well you could do dir /b /s within a for loop.
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #9 on: September 17, 2009, 09:44:29 AM »
          Well you could do dir /b /s within a for loop.

          The above would find the program and the location of the program ( assuming  the OP knows the name of the program. )  When the program is found, is the program executed or do we CD to the directory where the program is located?  Will the program be in a different directory each time the batch file is run?

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #10 on: September 17, 2009, 02:10:07 PM »
          Code: [Select]
          @echo off

          dir /s /b  msinfo32.exe


          dir /s /b msinfo32.exe  >  ms.txt

          echo ms.txt
          echo.
          type  ms.txt



          set /p var=< ms.txt

          echo  var = %var%

          "%var%"
          "C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe"
          C:\>

          Output:

          C:\>msin.bat
          C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe
          C:\WINDOWS\system32\dllcache\msinfo32.exe
          ms.txt

          C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe
          C:\WINDOWS\system32\dllcache\msinfo32.exe
           var = C:\Program Files\Common Files\MicrosoftShared\MSInfo\msinfo32.exe

          C:\>
          « Last Edit: September 17, 2009, 02:52:34 PM by billrich »

          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: help with some things in dos
          « Reply #11 on: September 17, 2009, 03:17:09 PM »
          What if there is more than one of the file? It will only run the first one found.
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #12 on: September 17, 2009, 03:23:06 PM »
          Code: [Select]
          REM This batch will find a folder ( directory ) and
          REM cd to that directory
          REM USAGE:  MSDIR  MSInfo

          @echo off



          dir /s /b  %1

          dir /s /b %1  >  ms.txt

          echo ms.txt
          echo.
          type  ms.txt



          set /p var=< ms.txt

          echo  var = %var%

          echo.
          echo cd to %1 using variable

          cd  "%var%"

          Output:

          C:\>MSDir.bat  MSinfo

          C:\>REM This batch will find a folder ( directory ) and

          C:\>REM cd to that directory

          C:\>REM USAGE:  MSDIR  MSInfo
          C:\Program Files\Common Files\Microsoft Shared\MSInfo
          C:\WINDOWS\msapps\msinfo
          ms.txt

          C:\Program Files\Common Files\Microsoft Shared\MSInfo
          C:\WINDOWS\msapps\msinfo
           var = C:\Program Files\Common Files\Microsoft Shared\MSInfo

          cd to MSinfo using variable
          C:\Program Files\Common Files\Microsoft Shared\MSInfo>
          « Last Edit: September 18, 2009, 01:48:11 PM by billrich »

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #13 on: September 17, 2009, 03:32:02 PM »
          Well you could do dir /b /s within a for loop.

          Store the files and the path to the files in a text file and use a for loop.

          The text file will quickly become very large when a search is done for all *.htm files or all *.bat files.  When each file is a .htm or .exe,  time and information would be nearly unmanageable.

          The original Poster needs to know the name of the file he is looking for.


          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: help with some things in dos
          « Reply #14 on: September 17, 2009, 03:35:44 PM »
          Store the files and the path to the files in a text file and use a for loop.

          The text file will quickly become very large when a search is done for all *.htm files or all *.bat files.  When each file is a .htm or .exe,  time and information would be nearly unmanageable.

          The original Poster needs to know the name of the file he is looking for.


          Don't bother putting it in a text file, do the dir directly in the for loop.
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.