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

Author Topic: ö in path in batch file  (Read 7195 times)

0 Members and 1 Guest are viewing this topic.

PeterD

    Topic Starter


    Greenhorn

    ö in path in batch file
    « on: October 09, 2008, 07:32:53 AM »
    I need to make a batch command which enters the date and time in a file. The actual batch file contains:

    Code: [Select]
    date/t >"E:\Maraddata\Tingö\puc.txt"
    time/t >>"E:\Maraddata\Tingö\puc.txt"

    But using the ö, MS-Dos don't recognize it. Anybody who can help me o create this text file with date and time in this "Tingö" folder???  ???


    Note that the command is running at a server with Win2003 installed.

    diablo416



      Hopeful
      Re: ö in path in batch file
      « Reply #1 on: October 09, 2008, 07:37:38 AM »
      cmd.exe recognizes the ö charachter
      the problem is your using quotations

      This works..
      date/t >E:\Maraddata\Tingö\puc.txt
      time/t >>E:\Maraddata\Tingö\puc.txt




      This Doesnt..
      date/t >"E:\Maraddata\Tingö\puc.txt"
      time/t >>"E:\Maraddata\Tingö\puc.txt



      PeterD

        Topic Starter


        Greenhorn

        Re: ö in path in batch file
        « Reply #2 on: October 09, 2008, 07:52:55 AM »
        I expect you didn't try it in a batch file. Because it doesn't work...

        Executing the batch file, the results:

        Code: [Select]
        E:\Maraddata\Tingö>date/t >E:\Maraddata\Ting÷\puc.txt
        The system cannot find the path specified.

        E:\Maraddata\Tingö>time/t >>E:\Maraddata\Ting÷\puc.txt
        The system cannot find the path specified.

        Please note the ÷ instead of the ö


        diablo416



          Hopeful
          Re: ö in path in batch file
          « Reply #3 on: October 09, 2008, 08:09:33 AM »
          I see what you mean, ok .. i played around with it for a while and this is what i came up with

          @echo off
          cd\
          if not exist %systemdrive%\maraddata mkdir %systemdrive%\maraddata
          cd %systemdrive%\maraddata
          for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a
          date/t >.\puc.txt
          time/t >>.\puc.txt

          diablo416



            Hopeful
            Re: ö in path in batch file
            « Reply #4 on: October 09, 2008, 08:11:38 AM »
            if the tingö folder exists it will work, otherwise create it manually first from the line

            PeterD

              Topic Starter


              Greenhorn

              Re: ö in path in batch file
              « Reply #5 on: October 09, 2008, 08:28:33 AM »
              Thank you!

              But...

              When I execute the batch file from the command line, no problem.
              But if the batch-file is executed by another process (a mail-client software program), i get the following: (I removed the @echo off)


              Code: [Select]
              C:\Documents and Settings\Administrator>cd\

              C:\>cd E:\Maraddata

              C:\>for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a
              File not found

              C:\>date/t 1>.\toc.txt

              C:\>time/t 1>>.\toc.txt

              ????

              PeterD

                Topic Starter


                Greenhorn

                Re: ö in path in batch file
                « Reply #6 on: October 09, 2008, 08:31:49 AM »
                and Tingö folder exists

                diablo416



                  Hopeful
                  Re: ö in path in batch file
                  « Reply #7 on: October 09, 2008, 08:34:04 AM »
                  the folder wasnt found because the folder didnt change,  try this instead



                  cd\maraddata
                  for /f "tokens=1*" %%a in ('dir /a:d ting* /b') do cd %%a
                  date/t >.\puc.txt
                  time/t >>.\puc.txt



                  PeterD

                    Topic Starter


                    Greenhorn

                    Re: ö in path in batch file
                    « Reply #8 on: October 09, 2008, 08:37:33 AM »
                     >:( Still not succeeded.

                    I can change the folder within the C-drive. But I failed to switch over to my E-drive

                    diablo416



                      Hopeful
                      Re: ö in path in batch file
                      « Reply #9 on: October 09, 2008, 08:39:01 AM »
                      oh, sorry i didnt realize E: wasnt your systemdrive,

                      HEres another way

                      E:
                      cd\maraddata\ting?
                      date/t>.\puc.txt
                      time/t>>.\puc.txt

                      PeterD

                        Topic Starter


                        Greenhorn

                        Re: ö in path in batch file
                        « Reply #10 on: October 09, 2008, 08:44:31 AM »
                        Right! Thanks, it works!

                        diablo416



                          Hopeful
                          Re: ö in path in batch file
                          « Reply #11 on: October 09, 2008, 08:46:53 AM »
                          no problem and welcome to the forums