wscript launch exe file spaces in path

Home Forums Scripting Windows Script Host wscript launch exe file spaces in path

This topic contains 4 replies, has 5 voices, and was last updated by Avatar dalesnail 2 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Avatar
    confuseis
    Participant
    #166833

    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 “contosovader” -k “wscript.exe C:UsersPublicRecorded TVJK3.vbs C:UsersPublicRecorded TVTest-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:usersrecorded”,

    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

    Avatar
    joeqwerty
    Moderator
    #304584

    Try it like this:

    & .owexec.exe -c “computer1” -u “contosovader” -k “wscript.exe “C:UsersPublicRecorded TVJK3.vbs C:UsersPublicRecorded TVTest-wscript.bat””

    Avatar
    dalesnail
    Member
    #383883

    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:usersPublicDocumentslaunchProgram.vbs c:usersPublicDocumentsBATfile.bat” -nowait

    Avatar
    wullieb1
    Moderator
    #245575

    It appears to be the spaces in teh path name.

    Try this

    & .owexec.exe -c “computer1” -u “contosovader” -k “wscript.exe “C:UsersPublicRecorded TVJK3.vbs” “C:UsersPublicRecorded TVTest-wscript.bat””

    Avatar
    Rems
    Moderator
    #228474
    confuseis;n509089 wrote:
    The space in the Recorded TV section of the file name is the blocker here.

    Error: There is no file extension with “c:usersrecorded”,

    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.

    [B]”wscript.exe “”C:UsersPublicRecorded TVJK3.vbs”” “”C:UsersPublicRecorded TVTest-wscript.bat”””[/B][/CODE]

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

    [CODE] [B]”wscript.exe “C:UsersPublicRecorded TVJK3.vbs” “C:UsersPublicRecorded TVTest-wscript.bat””[/B][/CODE]

    btw The PowerShell escape character is the grave-accent(), Doubled double quotes can be escaped like
    [B]”wscript.exe
    ”C:UsersPublicRecorded TVJK3.vbs”C:UsersPublicRecorded TVTest-wscript.bat””[/B][CODE] “wscript.exe “”C:UsersPublicRecorded TVJK3.vbs”” “”C:UsersPublicRecorded TVTest-wscript.bat”””[/CODE]

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

    [B]”wscript.exe “C:UsersPublicRecorded TVJK3.vbs” “C:UsersPublicRecorded TVTest-wscript.bat””[/B][/CODE]

    btw The PowerShell escape character is the grave-accent(), Doubled double quotes can be escaped like
    [B]”wscript.exe ”C:UsersPublicRecorded TVJK3.vbs”C:UsersPublicRecorded TVTest-wscript.bat””[/B][CODE] “wscript.exe “C:UsersPublicRecorded TVJK3.vbs” “C:UsersPublicRecorded TVTest-wscript.bat””[/CODE]

    btw The PowerShell escape character is the grave-accent(), Doubled double quotes can be escaped like
    “wscript.exe
    ”C:UsersPublicRecorded TVJK3.vbs”C:UsersPublicRecorded TVTest-wscript.bat`””

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.