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

Unexpected token W in JSON at position 273

Windows
2
5
302
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.
  • J
    Jaxon T
    last edited by Sep 22, 2020, 9:30 PM

    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

    R 1 Reply Last reply Sep 22, 2020, 11:45 PM Reply Quote 0
    • R
      Russ @Jaxon T
      last edited by Russ Sep 22, 2020, 11:46 PM Sep 22, 2020, 11:45 PM

      @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
      • J
        Jaxon T
        last edited by Sep 23, 2020, 11:29 PM

        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
        • J
          Jaxon T
          last edited by Sep 23, 2020, 11:31 PM

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

          R 1 Reply Last reply Sep 25, 2020, 12:41 AM Reply Quote 0
          • R
            Russ @Jaxon T
            last edited by Russ Sep 25, 2020, 12:43 AM Sep 25, 2020, 12:41 AM

            @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
            3 out of 5
            • First post
              3/5
              Last post