Announcement

Collapse
No announcement yet.

wscript launch exe file spaces in path

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • wscript launch exe file spaces in path

    Hi

    Ive looked around the net for this but nothing thus far works. I have zero knowledge of vbs

    I want to execute a bat file via a small vbs script, idea is to launch the bat invisibly, this has worked perfectly. I'm launching this command from powershell, remote execution tool launches the vbs command.

    -k (Command to run)

    & .\owexec.exe -c "computer1" -u "contoso\vader" -k "wscript.exe C:\Users\Public\Recorded TV\JK3.vbs C:\Users\Public\Recorded TV\Test-wscript.bat"

    The space in the \Recorded TV\ section of the file name is the blocker here.

    Error: There is no file extension with "c:\users\recorded",

    The articles Ive read mention using triple quotes """ Ive tried numerous different combinations but nothing works, So difficult to deal with a simple thing such as a space

    Any ideas ?

    Thanks

    Confuseis




  • #2
    Try it like this:

    & .\owexec.exe -c "computer1" -u "contoso\vader" -k "wscript.exe "C:\Users\Public\Recorded TV\JK3.vbs C:\Users\Public\Recorded TV\Test-wscript.bat""

    Comment


    • #3
      Tried that but no luck.

      What happens is a dialog box opens titled "Windows script host settings" with check boxes
      [ ] stop script after specified number of seconds
      [ ] display logo when script executed inside console


      below line with no spaces in the path worked perfectly, just that space is throwing it off

      & .\owexec.exe -c $computer1 -u $domain\$user1 -k "wscript c:\users\Public\Documents\launchProgram.vbs c:\users\Public\Documents\BATfile.bat" -nowait

      Last edited by confuseis; 31st January 2017, 22:28.

      Comment


      • #4
        It appears to be the spaces in teh path name.

        Try this

        & .\owexec.exe -c "computer1" -u "contoso\vader" -k "wscript.exe "C:\Users\Public\Recorded TV\JK3.vbs" "C:\Users\Public\Recorded TV\Test-wscript.bat""

        Comment


        • #5
          Originally posted by confuseis View Post
          The space in the \Recorded TV\ section of the file name is the blocker here.

          Error: There is no file extension with "c:\users\recorded",

          The articles Ive read mention using triple quotes """
          Have you tried with doubled double quotes around the paths?, ...not tripled.

          Because the "wscript.exe ... " command line is put between double quotes (the whole is one parameter on the owexec.exe command line) the inner double quotes needs to be escaped in order to prevent the owexec.exe command line will break, or the wscript.exe command line will fail.

          Code:
           "wscript.exe ""C:\Users\Public\Recorded TV\JK3.vbs"" ""C:\Users\Public\Recorded TV\Test-wscript.bat"""

          Or you can also try using the escape character \ (when a CMD prompt is used to execute the command)

          Code:
           "wscript.exe \"C:\Users\Public\Recorded TV\JK3.vbs\" \"C:\Users\Public\Recorded TV\Test-wscript.bat\""

          btw The PowerShell escape character is the grave-accent(`), Doubled double quotes can be escaped like
          "wscript.exe \`"C:\Users\Public\Recorded TV\JK3.vbs\`" \`"C:\Users\Public\Recorded TV\Test-wscript.bat\`""
          Last edited by Rems; 1st February 2017, 20:38. Reason: added CODE-tags

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment

          Working...
          X