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

Author Topic: Cant ignore special character no matter what I do  (Read 4013 times)

0 Members and 1 Guest are viewing this topic.

zask

    Topic Starter


    Intermediate

    • Experience: Experienced
    • OS: Other
    Cant ignore special character no matter what I do
    « on: March 24, 2016, 05:20:50 PM »
    Okay I will make a brief explanation on showing what i'm trying to do. I'm trying to make a program that will start google chrome for me each time
    the computer starts.

    Okay first I have a simple vbs file that runs a file name start.bat invisible.

    Set WshShell = CreateObject("WScript.Shell" )
    WshShell.Run chr(34) & "%TEMP%\Nigflikr\start.bat" & Chr(34), 0
    Set WshShell = Nothing

    I'm going to put this vbs file inside the batch file and run it. to do this i have to ignore the "&" character by placing the "^" character in front of it.

    @echo off
    echo @echo off >> "%TEMP%\start.bat"
    echo start chrome.exe >> "%TEMP%\start.bat

    echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"


    now I was messing with the code, and i would like to add more options as well as a menu, was i was wondering if i could also place the file from startup in the temp folder as well.

    @echo off
    echo @echo off >> "%TEMP%\start.bat"
    echo echo start chrome.exe >> "%TEMP%\start.bat
    echo @echo off >> "%TEMP%\startup.bat"

    echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"

    The only problem is that the out put spits out this code (startup.bat) in the temp folder.

    @echo off
    echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo WshShell.Run chr(34) & "%TEMP%\start.bat" & Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"

    This means that if have to ignore these "&" characters again so i tried this

    echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo WshShell.Run chr(34) ^^& "%TEMP%\start.bat" ^^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"

    cant do that because it cancels out the first "^" sign right before the "&" sign, so i tried this

    echo echo Set WshShell = CreateObject("WScript.Shell" ) ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo WshShell.Run chr(34) ^^^& "%TEMP%\start.bat" ^^^& Chr(34), 0 ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"
    echo echo Set WshShell = Nothing ^>^> "%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs" >> "%temp%\startup.bat"

    still doesn't work.

    my goal is to get the output of a batch file in the temp folder named (startup.bat) with this code inside of it.

    echo Set WshShell = CreateObject("WScript.Shell" ) >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo WshShell.Run chr(34) ^& "%TEMP%\start.bat" ^& Chr(34), 0 >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
    echo Set WshShell = Nothing >> "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"

    i cant do this because the "^" sign is used to ignore the "&" sign and i need to ignore another "^" sign infront of the other "^" sign next to the "&" sign, like this

    "^^&"
     ^
     |
    ignore this sign

    Can anyone help? Thanks, this has been driving me crazy!  :(


    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Cant ignore special character no matter what I do
    « Reply #1 on: March 24, 2016, 05:47:38 PM »
    Okay I will make a brief explanation on showing what i'm trying to do. I'm trying to make a program that will start google chrome for me each time the computer starts.

    I didn't read any further than to see that VBS is being used.
    Why not use a batch script in the startup group?

    zask

      Topic Starter


      Intermediate

      • Experience: Experienced
      • OS: Other
      Re: Cant ignore special character no matter what I do
      « Reply #2 on: March 24, 2016, 05:58:21 PM »
      The vbs file is used to start a specific batch file invisible, the vbs file is generated from the batch file, which is suppose to be a install batch file

      foxidrive



        Specialist
      • Thanked: 268
      • Experience: Experienced
      • OS: Windows 8
      Re: Cant ignore special character no matter what I do
      « Reply #3 on: March 24, 2016, 06:01:38 PM »
      Why invisible?  What's the point in this?

      It looks like what you've described is not what you want, or what you're doing.

      zask

        Topic Starter


        Intermediate

        • Experience: Experienced
        • OS: Other
        Re: Cant ignore special character no matter what I do
        « Reply #4 on: March 24, 2016, 06:15:59 PM »
        because i dont want to display the prompt when the batch file starts. The file doesn't require user input nor does it display any messages.
        there is no point in displaying the cmd window so i run it invisible instead. When i add a options menu, i wish to display that file instead because it does require a visual prompt to use, and i do not wish to display two prompts just because i wish to run a file in a specific folder from that options menu. The vbs code works fine, the problem is when i create the vbs file from the batch file, specific spacial characters is needed to be ignored or else when the batch file creates the vbs file, the code in that vbs file will not display that character and thus resulting in an error when the vbs file is started. the command line wont let me ignore that character because the "&" sign has to be ignored with the "^" sign, but also the "^" (For example ~ "^&") must also be canceled out (For example ~ "^^&") i cannot ignore the fist "^" sign in "^^&" because it interferes with the other "^" sign in "^&", and thus again resulting in an error.
        « Last Edit: March 24, 2016, 06:32:52 PM by zask »

        Geek-9pm


          Mastermind
        • Geek After Dark
        • Thanked: 1026
          • Gekk9pm bnlog
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: Cant ignore special character no matter what I do
        « Reply #5 on: March 24, 2016, 08:55:53 PM »
        This for general reference:

        Programs or shortcuts placed in the Startup folder will run whenever Windows starts. Click the Start button , click All Programs, right-click the Startup folder, and then click Open. Open the location that contains the item to which you want to create a shortcut. Right-click the item, and then click Create Shortcut.


        Most likely Zask will ignore this simple answer.  ::)

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Cant ignore special character no matter what I do
        « Reply #6 on: March 24, 2016, 10:07:21 PM »
        because i dont want to display the prompt when the batch file starts.

        zask, if you want people to use their free time to help you, then be up front with what you want to do.

        If you want to start chrome when your computer starts - without a batch window showing - then drag a shortcut from chrome into your startup group.

        If you want help to use a character in a line of code, then just show the line of code and ask your question.

        zask

          Topic Starter


          Intermediate

          • Experience: Experienced
          • OS: Other
          Re: Cant ignore special character no matter what I do
          « Reply #7 on: March 26, 2016, 06:31:40 PM »
          i am being front, all i need to know is how to ignore a ^ sign in front of ^&  :(

          foxidrive



            Specialist
          • Thanked: 268
          • Experience: Experienced
          • OS: Windows 8
          Re: Cant ignore special character no matter what I do
          « Reply #8 on: March 26, 2016, 07:38:18 PM »
          i am being front, all i need to know is how to ignore a ^ sign in front of ^&  :(


          Code: [Select]
          @echo off
          echo >"%TEMP%\start.bat" @echo off
          echo >>"%TEMP%\start.bat" start chrome.exe

          echo >"%TEMP%\makevbs.bat" @echo off
          echo >>"%TEMP%\makevbs.bat" set "file=%%APPDATA%%\Microsoft\Windows\Start Menu\Programs\Startup\run.vbs"
          echo >>"%TEMP%\makevbs.bat" echo ^>"%%file%%" Set WshShell = CreateObject("WScript.Shell")
          echo >>"%TEMP%\makevbs.bat" echo ^>^>"%%file%%" WshShell.Run chr(34) ^^^& "%%%%TEMP%%%%\start.bat" ^^^& Chr(34), 0
          echo >>"%TEMP%\makevbs.bat" echo ^>^>"%%file%%" Set WshShell = Nothing

          zask

            Topic Starter


            Intermediate

            • Experience: Experienced
            • OS: Other
            Re: Cant ignore special character no matter what I do
            « Reply #9 on: March 31, 2016, 04:42:11 PM »
            This for general reference:

            Programs or shortcuts placed in the Startup folder will run whenever Windows starts. Click the Start button , click All Programs, right-click the Startup folder, and then click Open. Open the location that contains the item to which you want to create a shortcut. Right-click the item, and then click Create Shortcut.


            Most likely Zask will ignore this simple answer.  ::)

            Works! :/

            zask

              Topic Starter


              Intermediate

              • Experience: Experienced
              • OS: Other
              Re: Cant ignore special character no matter what I do
              « Reply #10 on: March 31, 2016, 04:43:51 PM »

              foxidrive



                Specialist
              • Thanked: 268
              • Experience: Experienced
              • OS: Windows 8

              patio

              • Moderator


              • Genius
              • Maud' Dib
              • Thanked: 1769
                • Yes
              • Experience: Beginner
              • OS: Windows 7
              Re: Cant ignore special character no matter what I do
              « Reply #12 on: April 01, 2016, 06:43:05 AM »
               :P    ;D
              " Anyone who goes to a psychiatrist should have his head examined. "

              zask

                Topic Starter


                Intermediate

                • Experience: Experienced
                • OS: Other