Results 1 to 3 of 3

Thread: Run VBScript and Batch from hta page - issue with working directory

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2022
    Posts
    6

    Run VBScript and Batch from hta page - issue with working directory

    Hi

    I have a hta page from where I'd like to run some scripts in the folder "files".

    It is workind for simple scripts (see Button 1) but not for more complexe scripts (Button 2, 3, 4). It says path not found. If I run the complexe scripts in their folder it's working. I guess the reason is because the working directory is not defined. How can I do that?

    Code:
    <head><title>testpage</title></head>
    <Script language="VBScript">Set Wss=CreateObject("WScript.Shell")</script>
    
    		<body><table><tr><td align="center">
    			<br><br>1. Signatur erstellen (Sprachen waehlen):<br>
    			<form name="Form1">
    			<input type="Button" name="Button1" value="Deutsch">
    			<input type="Button" name="Button2" value="Franzoesisch">
    			<input type="Button" name="Button3" value="Italienisch">
    			<input type="Button" name="Button4" value="Englisch">
    
    
    			<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
    			   Wss.Run("files\test.vbs")
    			</SCRIPT>
    			<SCRIPT FOR="Button2" EVENT="onClick" LANGUAGE="VBScript">
    			   Wss.Run("files\AutoSignature_French.vbs")
    			</SCRIPT>
    			<SCRIPT FOR="Button3" EVENT="onClick" LANGUAGE="VBScript">
    			   Wss.Run("files\AutoSignature_Italian.vbs")
    			</SCRIPT>
    			<SCRIPT FOR="Button4" EVENT="onClick" LANGUAGE="VBScript">
    			   Wss.Run("files\AutoSignature_English.vbs")
    			</SCRIPT>
    			</form>
    		</td></tr></table></body>
    Thank you.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Run VBScript and Batch from hta page - issue with working directory

    Possibly useful links to supply the path:

    https://social.technet.microsoft.com...eto?forum=ITCG

    https://devblogs.microsoft.com/scrip...hen-it-starts/

    https://stackoverflow.com/questions/...e-value-to-hta

    Code:
    Wss.Run("D:\MainDir\SubDir\files\AutoSignature_English.vbs")

    Or, just hard-code them, at least to test.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2022
    Posts
    6

    Re: Run VBScript and Batch from hta page - issue with working directory

    Thank you. I hard-coded the paths in the more complex scripts for now. That's working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width