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 9953 times)

0 Members and 1 Guest are viewing this topic.

billrich

  • Guest
Re: help with some things in dos
« Reply #15 on: September 17, 2009, 03:58:34 PM »
Don't bother putting it in a text file, do the dir directly in the for loop.

Show us the code.  Search for all  *.htm files on you computer and execute each file.

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: help with some things in dos
« Reply #16 on: September 17, 2009, 04:06:14 PM »
For /f "delims=" %%a in ('dir /b /s *.htm') do echo %%a
Pause > nul

That will display all htm files, you can replace echo with whatever you want.
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 #17 on: September 17, 2009, 04:22:39 PM »
For /f "delims=" %%a in ('dir /b /s *.htm') do echo %%a
Pause > nul

That will display all htm files, you can replace echo with whatever you want.

Get2500, the original poster,  does not want to use the complete path to the file.  Get2500 needs to find the directory each file is in, cd to that directory and then execute the file.

By the way, does your for loop run from the root directory or some other directory?

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: help with some things in dos
« Reply #18 on: September 17, 2009, 04:30:38 PM »
Ok. Well as long as the path name doesn't have a . setting the delims to . will work.
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 #19 on: September 17, 2009, 04:51:37 PM »
Ok. Well as long as the path name doesn't have a . setting the delims to . will work.


What?

Helpmeh



    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: help with some things in dos
« Reply #20 on: September 17, 2009, 05:06:36 PM »
Ohh nevermind, I was thinking of getting filename without extension.
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

get2500

    Topic Starter


    Greenhorn

    Re: help with some things in dos
    « Reply #21 on: September 19, 2009, 11:34:42 AM »
    i need it to cd to the directory like billrich said

    billrich

    • Guest
    Re: help with some things in dos
    « Reply #22 on: September 19, 2009, 11:40:16 AM »
    i need it to cd to the directory

    Why?  A complete path to the file works better.

    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>

    get2500

      Topic Starter


      Greenhorn

      Re: help with some things in dos
      « Reply #23 on: September 19, 2009, 11:42:48 AM »
      well when i cd to the complete path it says "invalid path"

      get2500

        Topic Starter


        Greenhorn

        Re: help with some things in dos
        « Reply #24 on: September 19, 2009, 11:46:29 AM »
        nvm i finally solved it

        someone posted
        Code: [Select]
        For /f "delims=" %%a in ('dir /b /s *.html') do echo %%a
        Pause > nul
        and i changed "do echo" to "do appletviewer %%a"

        billrich

        • Guest
        Re: help with some things in dos
        « Reply #25 on: September 19, 2009, 11:47:00 AM »
        well when I cd to the complete path it says "invalid path"

        Don't CD. Your file is not a directory.

        copy and paste the complete path to the command prompt and press enter

        or place the complete path in batch file and run

        Post your Batch file.

        get2500

          Topic Starter


          Greenhorn

          Re: help with some things in dos
          « Reply #26 on: September 19, 2009, 12:08:15 PM »
          Code: [Select]
          @echo off
          echo.
          echo RULES
          echo.
          echo Use your mouse to move the paddle and hit the ball
          PING 1.1.1.1 -n 1 -w 2000 >NUL
          echo Ball changes color when spin is applied
          PING 1.1.1.1 -n 1 -w 2000 >NUL
          echo The faster the ball is going the more points you get
          PING 1.1.1.1 -n 1 -w 2000 >NUL
          echo If you miss the ball you lose 1000 points
          PING 1.1.1.1 -n 1 -w 2000 >NUL
          echo.

          echo READY
          PING 1.1.1.1 -n 1 -w 3000 >NUL
          echo.

          echo SET
          echo.
          PING 1.1.1.1 -n 1 -w 3000 >NUL

          echo GO!
          For /f "delims=" %%a in ('dir /b /s *.html') do appletviewer %%a
          Pause > nul


          i already solved it tho

          billrich

          • Guest
          Re: help with some things in dos
          « Reply #27 on: September 19, 2009, 12:42:01 PM »
          Get2500,

          I'm happy you solved the problem.

          How many .html  files were there?

          In what directory were the .html files?


          You solved the problem but I'm still confused.

          Thanks for your help
          « Last Edit: September 19, 2009, 01:54:40 PM by billrich »

          get2500

            Topic Starter


            Greenhorn

            Re: help with some things in dos
            « Reply #28 on: September 19, 2009, 08:19:59 PM »
            well, the code that worked for me...didnt work all the time. how do u get that part of code
            Code: [Select]
            For /f "delims=" %%a in ('dir /b /s *.html') do echo %%a
            Pause > nul
            to work for all drives. like if i have the files on a flash drive

            Helpmeh



              Guru

            • Roar.
            • Thanked: 123
              • Yes
              • Yes
            • Computer: Specs
            • Experience: Familiar
            • OS: Windows 8
            Re: help with some things in dos
            « Reply #29 on: September 19, 2009, 08:36:32 PM »
            Before the *, add this E:\ (or whatever drive), so it looks like E:\*.htm
            Where's MagicSpeed?
            Quote from: 'matt'
            He's playing a game called IRL. Great graphics, *censored* gameplay.