Jump to content
Sign in to follow this  

Running A Vbs File With Spaces In Name.

Recommended Posts

I am currently working on an AutoIT exe that will allow some of our IT Liasions to call a VBS file to install/update some software. I started having issues when I tried to call a script that has spaces in the name of the file. I have tried different quote sets and using FileGetShortName and so far have only been successful when using FileGetShortName. But when I use that and I display a message box in the vbs that uses the name of the script, it will display the shortname and not the long name.

FileGetShortName does not seem to be what I can use, at least at the moment, so I was hoping someone could give me a hand with quotes on the below code..

;Hide the Tool Tray icon
$installScriptPath = "\\SERVER\desktop$\Standard\Macromedia\Install Shockwave and Flash.vbs"
$installScriptTitle = "Macromedia Shockwave and Flash"
$installScriptShortPath = FileGetShortName($installScriptPath)

If IsAdmin() = 0 Then
    MsgBox(0, "Local Admin Rights not detected", "Local Admin rights are required for this installs/updates to occur." & @CRLF  _
    & "Please login with Admin rights and try again.")

;If FileExists ($installScriptPath) Then
If FileExists ($installScriptShortPath) Then
    ;Comment out the Run and uncomment the msgbox to test FileExists = True
    ;Msgbox ( 0,"Title","File is present")
    ;Run ("wscript.Exe " & $installScriptPath)
        Run ("wscript.Exe " & $installScriptShortPath)
    Msgbox (16,"Error with " & @ScriptName,"You are unable to access the file *" & $installScriptPath & "*" & @CRLF & @CRLF _
    & "Please contact the Administrator or your IT Liasion.")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...