Actually i am using nodejs + electronjs for my application and also i am using screensaver for my app.When i start my batch file it executes and shows cmd prompt window on top of my screensaver.So,i want to execute my batch file in background.Can you please give perfect solution for my need?
Try this:
Save as invisible.vbs:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
Then run your script after calling the vbs script
invisible.vbs <script>
you can use either batch script
#echo off //for remving console text
//Other codes
exit /b 0 //for removing console
pause>nul
I have also faced such type of situation where I had to generate PDF files and allow printer to execute print command for printing pdf files with default printer.for this purpose I have used sumatrapdfreader.I have also developed a package print I think it will be helpful for u.I am sharing link to u.
package link on github
Related
I want to print pdf attachments automatically that arrive at a specific mail adress. For this purpose I have set up Filtaquilla so that pdf attachments are automatically stored in a specific folder. Further I have programmed a little shell script to print all pdf files in that folder. When started manually the script works fine. However launching the script from Filtaquilta does not work. Has anyone any suggestions?
I found the solution myself. Filtaquilla apparently takes very long to transfer the PDFs in the folder I specified. Therefore the script did not find them. The solution was to let the script wait for 2 min (Command at beginning: sleep 120). Now everything works fine. A further note: When Filtaquilla launches a script you have to specify the absolute path when accessing a file with the script. Otherwise it will not work (from what I have seen).
I am playing around with the basics of VBS and have a very simple Visual Basic script which executes a file using shell.
I am using Excel under Windows 10.
Sub Whatever()
Dim Example_One As String
Example_One = "C:\Users\IEUser\python-3.8.0.exe"
Shell Example_One, vbNormalFocus
End Sub
The weird thing is that some files will run (e.g. Python as above) while others e.g. VLC, WinRAR give the error: Run time error 5: Invalid procedure call or argument.
I simply cannot figure out why some .exe files will run and others will not. I thought it might be something to do with how the installation works but ChromeSetup.exe works while VLC.exe does not (even though they both ask "Do you want this app to make changes to your device?" (Python has it's own installer). Double-clicking all files in Windows Explorer runs them as normal (they don't ask for any special rights).
I just downloaded python on a new pc and now whenever I try to create a script the output viewer just closes down immediately when I launch it as a python file.
My original script was
import secrets
secrets.token_hex(32)
but it just closes down immediately. I thought that it was something with my code so I tried to just make the simple "hello world" script.
(print) "I hope this work"
and I had the same result as the first script, the output window opened up then immediately closed down.
I can get it to work using the python shell but I prefer doing all my coding using notepad++ and it would a real pain in the behind if I can't get that to work.
This is expected behavior if you run your scripts as you described, by opening them in Explorer. Your script completes execution in a terminal window, then closes immediately.
If you absolutely insist on running them on double click and still want to see your console, I suggest you create a .bat file at your python path with contents like this:
python -i %1
and them bind your double-click handler to use that file on .py extension. That way, Python will execute your file and go into CLI mode, preserving your terminal window and allowing you to type further commands.
My other guess would be that you want a console plugin to work right within Notepad++, in that case use nppexec: https://sourceforge.net/projects/npp-plugins/files/NppExec/
I have a batch file contains
echo test string >>Log.txt
when i click on it it will make a Log.txt file and the "test string" will be in it. But when i run the batch file from VBA excel using WScript.Shell it is not creating the Log.txt file. But the batch code is running. How can I make it working? I am using windows7 and excel 2007
I suggest specifying an absolute path to the file.
echo test string >>"%USERPROFILE%\Document\Log.txt"
The most common frustration I experience when using relative paths is that it's relative to the "working directory" windows uses for the calling process, and if it's launched from Explorer, that can easily be %WINDIR% or some place where you don't want stuff saved.
I can create normal silent executable by selecting 'Hide all' option in Silent mode through SFX options.
But when I add file in SFX options -> Setup program ->'Run after extraction' e.g. devnode.exe
devnode.exe does not run silently.
Is there way to run setup file silently?
Windows opens automatically a console window if devnode.exe is a console application and not a Windows (GUI) application. This can't be avoided. Only Windows application can be executed without showing a window if the application is coded not opening a window on execution.
However, usually it is good practice to show a user executing a self-extracting archive what is going on. The requirement of a completely hidden installation using a self-extracting archive is something mainly bad guys need.
A good installation of an application which need to run a console application is done best with running a batch file after extracting the files showing with 1 or more echo messages what happens now before running the console application from within the batch file and delete with last line in batch file the batch file itself.
Example of such a setup/install batch file:
#echo off
rem Set title for the console window.
title Installation of XXX
rem Output information for the user.
echo Installing XXX, please wait ...
rem Call the console application which completes the installation.
devnode.exe
rem Delete this batch file as not needed anymore.
del %0
Note: The batch file is executed always with surrounding double quotes and therefore %0 is a string containing already double quotes at beginning and end. So it would be wrong to use double quotes around %0 in the last line.