How to run my vbs
Akasha51150
Posted messages
8
Status
Membre
-
Akasha51150 Posted messages 8 Status Membre -
Akasha51150 Posted messages 8 Status Membre -
Hello everyone,
I'm new to the forum, and I'm here to share my problem.
In my workplace, I used a VBS script every day to get forecast volumes; everything was going well until one day someone in the office got "infected" by a file that uses a VBS extension.
In a fit of totalitarianism, our dear IT department unilaterally decided to disable the program that allows VBS files to run.
I found a workaround to run my file by right-clicking/open with and selecting Cscript.exe, but I find it cumbersome to have to do this every day when I could previously combine it into an Excel file where I just had to press a button...
Now, when I press that button, it opens the VBS file... but in Notepad.
They also generously provided a .bat file that essentially says:
C:\windows\system32\Cscript.exe Myfile.vbs, but when I run it, it tells me it can't find my file....
Can someone help me?
I'm new to the forum, and I'm here to share my problem.
In my workplace, I used a VBS script every day to get forecast volumes; everything was going well until one day someone in the office got "infected" by a file that uses a VBS extension.
In a fit of totalitarianism, our dear IT department unilaterally decided to disable the program that allows VBS files to run.
I found a workaround to run my file by right-clicking/open with and selecting Cscript.exe, but I find it cumbersome to have to do this every day when I could previously combine it into an Excel file where I just had to press a button...
Now, when I press that button, it opens the VBS file... but in Notepad.
They also generously provided a .bat file that essentially says:
C:\windows\system32\Cscript.exe Myfile.vbs, but when I run it, it tells me it can't find my file....
Can someone help me?
1 réponse
Hello,
it probably just requires adding the full path to the VBS file, for example:
Adding quotes if there are spaces in any of the names in the path (file or folder):
Then there are options for launching cscript that can be used to adapt the behavior of the vbscript engine to your needs...
You may stop me but you can't stop us all ;-)
it probably just requires adding the full path to the VBS file, for example:
C:\windows\system32\Cscript.exe C:\MyScripts\Myfile.vbs
Adding quotes if there are spaces in any of the names in the path (file or folder):
C:\windows\system32\Cscript.exe "C:\My Scripts\My file.vbs"
Then there are options for launching cscript that can be used to adapt the behavior of the vbscript engine to your needs...
C:\windows\system32>cscript
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.
Usage : CScript scriptname.extension [option...] [arguments...]
Options :
//B Batch mode : Suppresses the display of prompts and script errors
//D Enable debugging
//E:engine Use the engine for script execution
//H:CScript Replace the default script runtime environment with CScript.exe
//H:WScript Replace the default script runtime environment with WScript.exe (default)
//I Interactive mode (default, opposite of the //B option)
//Job:xxxx Execute a WSF task
//Logo Display a logo (default)
//Nologo Prevent displaying a logo : No banner is displayed during execution
//S Save the current command line options for this user
//T:nn Execution time in seconds : Maximum time allowed for script execution
//X Run a script in the debugger
//U Use Unicode for redirected console I/O
You may stop me but you can't stop us all ;-)
Edit: I just tried from my VPN connection, with and without quotes, and when launching the .bat file, I see a Command Prompt window open and then nothing happens.
for example prevents the display of interaction windows (asking the user a question for example) that may appear when launching the script by double-clicking (when it is properly associated with the engine), thus allowing for automatic launching...
Conversely, without an operator on the machine, the script would wait indefinitely for a response... Of course, this operation in "standalone mode" must have been considered in the script at the time of its writing to provide a default value for a variable and/or find the answer to the question by itself.
If you don't know how to use them and what they might be for, there's a good chance you don't need them.