I want to run a bat file in background. I searched in google and I found some examples using hstart and cmdow. But Isn't anyway to do this with windows commands? I really feal good when I don't add extra programs to my project !
thanx in advance
I'm using window scheduler. I found a way :
Save this one line of text as file invisible.vbs:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
thanx
It really depends on the programming language and platform you are using.
In Windows, using the C# language on the .NET platform, it is:
System.Diagnostics.Process.Start(#"C:\myfile.bat");
You can try to run the batch file as a windows service. You will perhaps need to have admin previleges on your host to do this, but if you want to go for it, its easy to add/configure using sc command.
Related
So i have been looking for this on this website and cannot seem to find it so im asking you how to do it
If you are looking to display a list of processes from the command prompt you can use TaskList.exe if you are looking to just open the windows Task Manager you can use TaskMgr.exe
For standard batch file you would just use tasklist.exe. If you were using powershell you would use start-process tasklist.exe -nonewwindow.
I created a batch file to start several programs, including Task Manager. I used this code:
cd C:\ProgramData\Microsoft\Windows\Start Menu\Programs
start taskmgr
if this path does not work for you, right click on the task manager app and look at the path in the "properties"
start taskmgr
should work :)
(tested, it works!)
You can use this with a batch file: start "" TaskMgr.exe
I tried it on Windows 11, it worked fine.
I'm trying to make a batch file that will run the following command:
control name Microsoft.Personalization page pageWallpaper
How do I do this?
EDIT: I should be more specific. I know how to create a batch file but all I have written in the file is the code above, which just flashes a window and then does nothing.
The following should do what you need:
#echo off
control /name Microsoft.Personalization /page pageWallpaper
The syntax of control.exe requires the slashes before name and page.
Source: Add classic personalization menu in Windows 10 build 10074
Also, Command Line Commands for Control Panel Applets helped lead me to the answer.
I started by googling "windows control.exe command line options".
You know how to create batch files, but if you have any trouble putting the code above into a batch file and running it, and cannot figure out how, please let me know.
This works for me, running:
C:\bin> ver
Microsoft Windows [Version 10.0.14393]
Hope it works for you!
Regards,
Lud nom
because Bitsadmin is getting deprecated I would like to hear if you know about an alternative to Download files from within a batch script.
Best would be an alternative that already comes with windows so I don't need to download extra stuff.
Bacon Bits and I had the same idea at the same time. Here's an example using PowerShell's BitsTransfer module. Save this as a .bat file and run it.
#echo off
setlocal
set "URL=http://cdn.sstatic.net/stackoverflow/img/sprites.svg"
set "SaveAs=sprites.svg"
powershell "Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%SaveAs%'"
Good news -- BitsAdmin isn't being deprecated.
(I work for the BITS team at Microsoft)
The best alternative to BITSAdmin.exe is to use PowerShell.
If you cannot use PowerShell, you're pretty much stuck with copy, xcopy.exe, and robocopy.exe.
How can I download a file with batch file without using any external tools? - you can check this
Probably the powershell is the best alternative Though you still can find vista and XP machines without powershell - if portability is important for you
go to WSH.
.I don't think MSXML2.XMLHTTP and WinHTTPRequest (here I've a little bit more powerful tool based on winhttprequest - and more tested ) are going to be deprecated any time soon but they will require WSH or jscript or vbscript or powershell.
jscript.net and webclient will work better for bigger files.
I have created a run key in the registry for a simple batch file which copies the ip of a server I play COD on to the clipboard, so I don't have to open my browser to get it.
However, every time I log on, it displays the annoying CMD which does the copying.
Is there a way to hide the program started via Registry, so it doesn't show up unless task manager is opened? I prefer this as a solution as opposed to another method.
Thanks
You can use a vbs file to launch a batch file with the window hidden so that it is only visible in task manager.
Visit: http://www.instructables.com/id/Start-a-batch-file-completely-hidden/ for a brief instructable.
The code is basically:
CreateObject("Wscript.Shell").Run """" & "C:\batch-file.bat" & """", 0, False
You can compile it with a program called "advanced bat to exe". Google it, it's free.
Once you compile the script, there is an option that says "launch invisible". This is what you want.
I think this is the best method, as there's only one file. It's also probably the easiest.
Sorry if this is a very simple solution, but I have searched and couldn't find an answer, and have limited programming experience. What I am trying to accomplish is making Minecraft download and run outside of %appdata% on windows. I would like it to download .minecraft to a separate folder and run from there. To accomplish this, I wrote a .bat file with this code:
set APPDATA=%CD%\data
bin\minecraft.exe
this worked PERFECTLY. The catch is, I have a friend's computer that I want to do the same on, which runs Ubuntu. Is there a way to write one .jar file that works exactly the same that would work for both windows and linux? Thank you in advance for the help :)
No, just write
#!/bin/sh
APPDATA=somewhereorother/data bin/minecraft
chmod +x it, and use that for Linux.