Same BAT file behaving differently when called from Desktop or from within a Program - windows-7

I'm using Windows 7. I want to trigger a BAT file to run once some sound happens.
The BAT file should trigger a Skype call.
For that, I'm using the following BAT command:
c:\"Program Files"\Skype\Phone\skype /callto:someUsername
Skype should be already running before the trigger. If I double-click this BAT file on my desktop, it will run smoothly, pop up Skype, and start the call.
Now I'm using ISpy software to trigger the BAT file over a specified sound threshold.
ISpy is working fine. It detects the sound and triggers the BAT file.
But when the BAT file starts running, instead of popping up Skype it tries to load a new Skype instance.
Is there a context difference between calling BAT file with double click or within ISpy?
How can I overcome this?

#PaulojFonseca hasn't checked in since one day after this post, meaning Oct 29, 2012, so he won't likely come back to post his answer. Even though he won't be here to accept his own answer, I'll post it so at least it will show up. I've edited it to make the answer easier to read without much context.
"... when running ISpy, ... not all permissions [that were needed were] enabled. If i change this in the security preferences than the batch file runs smoothly."

Related

wscript.exe stopped working with a custom protocol

All the computers in our company are configured with a custom protocol that runs a vbs script, so when you click on a link with that user protocol, the vbs script starts and performs operations that interact with the file system and applications otherwise inaccessible to the browser.
This is the .reg file used to register the protocol:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\<name>]
"URL Protocol"=""
#="Url:<Description>"
"UseOriginalUrlEncoding"=dword:00000001
[HKEY_CLASSES_ROOT\<name>\DefaultIcon]
#="C:\\Windows\\System32\\WScript.exe"
[HKEY_CLASSES_ROOT\<name>\shell]
[HKEY_CLASSES_ROOT\<name>\shell\open]
[HKEY_CLASSES_ROOT\<name>\shell\open\command]
#="C:\\Windows\\System32\\WScript.exe \"C:\\Program Files\\<name>.vbs\" \"%1\""
The script has worked beautifully since 2014 without problems on ~50 computers.
Last week one user complained that it stopped working. I found out that WScript.exe doesn't work anymore, so I copied it creating WScript2.exe, modified the custom protocol to run WScript2.exe and it restarted working.
This morning also my computer didn't listen to the clicks on my custom protocol. I made a copy of WScript.exe to WScript2.exe and it restarted working.
I am expecting my phone to start ringing soon.
Why did WScript.exe stop listening to the custom protocol?
Why its identical copy still works?
EDIT (answers to comments)
Perhaps if I knew how to better describe "it stopped working" then I would know how to fix it :)
I don't know if it stopped working because of a Microsoft update, an anti-virus update or a change on the IT infrastructure/configuration. Here is a quick summary of what led me to the workaround:
I compared my custom protocol to a working one, I picked mailto as a reference
I noticed that changing the last line of the .reg file (see above) it would work with any other executable, but it wouldn't work with wscript.exe
I compared the execution of wscript.exe on the affected computers to its execution on computers (not yet) affected and there is no difference
A double click shows the same Windows Script Host Settings dialog
The execution from a command prompt with the same arguments used by the custom protocol works as expected
The custom protocol passes the correct arguments when executing another executable
At this point I thought that Windows blacklisted wscript.exe and I started searching for an alternative
I tried to rename wscript.exe to wscript2.exe but I couldn't because I don't have TrustedInstaller permission
I made a copy instead of renaming it
I tested the copy from the command prompt and it was working like the original
I tested the copy from the custom protocol and it was working like the original once did
EDIT 2 (more answers to comments)
All the computers have Windows 10 Pro.
Clicking on Settings - Updates & Security - View update history it says Feature update to Windows 10, version 1803 Succesfully installed on 5/22/2018. Clicking on Show what's new in this update shows nothing useful.
EDIT 3
Doesn't work = no symptoms, nothing happens, nothing is executed, nothing is logged (as far as I know).
I tried with a simple vbscript with a single line MsgBox "Hello". It works running it from the command line, but it doesn't work from the custom protocol. The task manager doesn't show anything popping up, but I don't know if it doesn't show it because the lifespan is too short to show or because it doesn't execute. The same script works with wscript2.exe.
My feeling is that something (Windows, anti-virus, ...) is blacklisting the custom protocol + wscript.exe thing, but not the custom protocol + any other executable or any other environment + wscript.exe. That's why I tried to copy wscript.exe to wscript2.exe. And I was pleasantly surprised to find out that it works.

C:\windows\SysWow64\CScript.exe window pop up

I created a macro in Excel and i am running it from a .vbs file. It's working fine on my laptop. I copied the same work on a new laptop and each time i am running the vbs file this window appears on the screen.
I have made some research and read that the situation i mentioned is happening when loading CheckNDISPort service on the startup. But i don't believe it's the reason because when i go to task manager and check in the startUp tab i don't find this service. Also when i restart my laptop i don't get this window, only when i am running my vbs file. I am sure there is any problem with my vbs file too because on the other laptops it's working fine.
Any suggestion please how to get ride of this pop up ? For now i am closing the window each time or ending the task from task manager but everytime i run it again so it pops up again.
Thank you very much.
Windows Scripting Host has two interpreter front-ends, wscript.exe and cscript.exe. cscript.exe is a console application and if cscript.exe is set as the default a console window will open every time you execute a script.
Run cmd.exe elevated as administrator and run wscript.exe //h:wscript.
Depending on the Windows version, you might also be able to right-click a .vbs file, select "Open with...", choose %windir%\system32\wscript.exe and check the "default" checkbox.

Run a hidden cmd on click

This is driving me crazy. I have a pretty application that does.. well, things. To start it up, some start.cmd needs to be executed. What start.cmd does is to set up some environment variables, check a few things and then start my main GUI program.
Now, everything works fine: when I click on my start.cmd everything gets launched properly. However, clicking on start.cmd causes an ugly, ugly cmd.exe to appear for an instant and then disappear. This is unacceptable!
I started looking around and I found this. It suggests to use some wscript invisible.vbsto run my start.cmd. This, however, works fine from the terminal, but I can't click on invisible.vbs directly to get what I need.
This is where I thought that I could use shortcut with the wscript invisible.vbs start.cmd command in it. However, you cannot make relative path shortcuts in Windows, which means that if I use a shortcut I will never be able to move my folder again, which is pretty bad if I need to install it around my users' computers.
So I really have no clue on how to get this apparently trivial thing done: how can I get a start.cmd batch file executed without anything showing and without having to launch anything from the terminal, and in a way that will allow me to move my folder around?
Check the hidder.bat . You can use it to wrap a .bat or .exe file into iexpress executable file that will be ran in hidden mode.To use you need:
hidder.bat example.bat hiddenExample.exe
this line will create a hiddenExample.exe which clicked will start your bat in hidden/background mode.You can also take a look at this question

Execute script on windows event no result timed script yes

I have a script that normally executes every 5 minutes.
It starts a Photoshop session and treats pictures in a folder.
This works but I need to stay logged in to the PC.
I tried with the setting Run logged on or not.
I then created a windows task based on a event 4663 and/or 5145.
When a file now arrives in the folder the event fires the script I even see Photoshop launching, but no pictures is treated.
It's the same script so I don't know why this is the case..
Regards
Guy

Is there any way to run a VBScript file as a screen saver?

Can you execute a VBS file as a screen saver? I have managed to rename cmd.exe to *.scr and this works, but I need to be able to run a VBS file as the screen saver if this is possible.
No, this is not possible.
In Windows, screen savers (*.scr files) are a special type of executable (.exe) file. That is why renaming a program like cmd.exe to cmd.scr causes it to sort of "work" as a screen saver. In particular, screen savers respond to certain command line switches (or parameters), which is how the OS gets them to do things like show the configuration dialog or display a preview.
But you can't compile VBScript files into executables, so there's no way to make this trick work for them.
You might be able to migrate the VBScript code to a VB 6 application, which you could then compile into an executable and run as a screen saver, but I can't imagine that this would be worth the development time. If you're interested in such a thing (and can get your hands on an old copy of VB 6!), you can probably find several how-to guides online, like this one.
But I'm honestly having a hard time imagining why one would ever want to run a VBScript script as a screen saver, or what it would display on the screen. You don't have very much control over what gets displayed on the screen, and you can't call down to native Windows API functions from VBScript. You'd end up relying upon some external library, so you might as well just use that library in the first place.
You can simply write a batch file that starts your vb script:
CD "%SystemRoot%\System32"
Start /Wait Wscript.exe "c:\program files\myscript.vbs"
Exit
Then compile the batch to exe, rename the exe to scr.

Resources