TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Unexpected token W in JSON at position 273

    Windows
    2
    5
    277
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jaxon TJ
      Jaxon T
      last edited by

      I'm trying to get my computer to sleep on command.
      This is my command line

      "trigger": "Sleep",
      "command": "C:\Windows\System32\psshutdown /d /t 1",
      "ground": "background",
      "voice": "Sleep",

      When I tell it to run a java error pops up with "Unexpected token W in JSON at position 273" and when I write psshutdown \d \t 1 without the whole directory nothing happens.

      Thanks, Jaxon

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @Jaxon T
        last edited by Russ

        @Jaxon-T, I think I know why you're seeing that error:

        For proper json formatting, the backslashes in your command path need to be double-backslashes, like this:

        "command": "C:\\Windows\\System32\\psshutdown /d /t 1",
        

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • Jaxon TJ
          Jaxon T
          last edited by

          After I did what you said it happened again except this time it said

          Unexpected token } in JSON at position 132

          the whole text command editor is just

          [
          {
          "trigger": "Sleep",
          "command": "C:\Windows\System32\psshutdown /d /t 1",
          "ground": "background",
          "voice": "Sleep",
          }
          ]

          btw i tried psshutdown with and without .exe at the end so the other text editor looks like

          [
          {
          "trigger": "Sleep",
          "command": "C:\Windows\System32\psshutdown.exe /d /t 1",
          "ground": "background",
          "voice": "Sleep",
          }
          ]

          1 Reply Last reply Reply Quote 0
          • Jaxon TJ
            Jaxon T
            last edited by

            btw when i copy and paste the text it takes away the double slash so these are double slashed!Capture.PNG

            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @Jaxon T
              last edited by Russ

              @Jaxon-T, if you use three of these "back ticks" ` before and after your text, it will show it as a code block and keep any backslashes intact.

              Like this:

               {
                "trigger": "sleep",
                "command": "d:\\tools\\pstools\\psexec -h C:\\\\Windows\\System32\\psshutdown.exe /d /t 1",
                "offCommand": "",
                "ground": "background",
                "voice": "sleep",
                "voiceReply": "",
                "allowParams": "false"
               }
              

              I tried your command and it didn't work because of UAC. You'll notice I ran it with psexec -h. That worked because it's running as a background command which runs it as Local System which has access to run things "As Administrator" with psexec -h.

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • First post
                Last post