Running an .exe from within a .bat - windows

I realize this might be a very basic question but I am slightly new to working with batch.
I am trying to use delprof to delete user profiles off multiple remote computers. I have Delprof.exe saved and can run it from a cmd window to put in different required arguments such as "/p /d:30". I can have my batch file run the application using the start command but it quickly closes the window.
I need to have delprof run from the batch but be interactive so it can prompt me with what profiles it has found and if I want to delete them. Basically Im trying to use this so I dont need to enter the arguments every time. I want it to be one click on the batch file and it will pop up with the profiles found and ask me which ones it should delete.

You are not clear on exactly what you want. But omitting start will probably do what you want. Which is run delprof as if you typed it at command line.
If not see the set /p command.
set /p remote=Enter Computer Name
delprof /c:\\%remote%

Related

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

Windows Batch File for Login Shortcut

I know you can use tsdiscon.exe and tscon.exe to connect to a user account via the command line.
I want to write a simple batch file to accomplish this, so I can have a shortcut on my desktop that will quickly and easily login to another user account on this system.
I share this computer with my in-laws, and they are not very computer literate. Currently there are many steps in switching to their account, and I want to make it more streamlined for them.
It's been awhile since I've written a batch file, but I am sure there is a way to run a simple IF/THEN statement, that would check to see if the user is logged in, then either log them in with the given credentials, or switch to that users profile.
I want to know the syntax to make this happen, so I can put the .bat file on the desktop for them to click on.
Is this possible?
Logging out to your account? Suppose impossible.
Suppose your user is usr1 and you save your batch file to, say, your desktop.
Then, by running this batch file, you run it as usr1.
If your batch file contains the log out statement, it therefore ends the user account, therefore terminating the batch file, thus not being able to run the batch file successfully.
However, switching to a different account could be possible.
Try this out, if it works.
Essentially, you're doing the following:
#echo off
taskkill /IM explorer.exe /F
runas /user:COMPUTERNAME\ACCOUNTNAME explorer.exe
(Replace COMPUTERNAME and ACCOUNTNAME with the current computer name and account name (i.e. C:\Users\ACCOUNTNAME) of your in-laws account)
If that's not what you wish, then, sorry, I can't help you.
The batch script I previously mentioned here
Just give your machine a simple name customise one line in script. Test from command prompt:
fus
If it works with win10 you should be able to create two shortcuts with commands:
fus.bat 1
and
fus.bat 2

Can you run Windows batch file not in a command prompt?

My programming teacher is requiring that everyone participate in the science fair this year, and now they accept computer-related projects. So, knowing only one language (Windows batch), I asked if I could make some kind of text based game in batch code. She said that I can only write the code, but not execute it.
She said that if we're even caught on the command prompt, we apparently get in big trouble and never get access to a school computer for the rest of the time I'm at the high school, or something like that... Even if all the code contains is a bunch of echos and simple variables, she won't let me and my partner run it. She also said that we must work on the project during school in her class.
So to sum all that up, she's letting me write a game/program, but I'm not allowed to test it to make sure it works in school, which will be when I'm writing it most...
So is there any way to run/test a batch script with simple echo and set /p commands without the "dangerous, black command prompt" showing up?
I think she has no idea what she's talking about, because on the board, she wrote "back script" lol
A batch file runs like any other executable file by double-clicking the file within Windows. However, because a batch file runs in a command line it immediately exits when done, so you may only see a black box for a second.
If the batch file is closing too fast, or you want to read the output from the batch file you can edit the batch file and add a pause to the end of the file. The pause command waits for user input before continuing.
A .BAT file can be made into a .EXE or .COM file to keep the program's source hidden from a user. You could use the .BAT to .EXE converter file to convert the batch files to .EXE file. In this program you can point to the batch file you want to convert into an executable file, include additional files, change the icon of the file, and add file details.
For Information on Batch files, this is one of the best resource.
Try this:
#echo off
color F0
mode con lines=25 cols=60
cls
title "Notepad - MyProgram.bat"
set /P "name=What is your name? "
echo Hello %name%, glad to see you...
pause
Execute it via a double click or enter in files browser...

Windows task scheduler: save a text file

Gist: I want a task scheduled that just saves an existing text file every 15 minutes.
I used the task scheduler to create a task and when I'm in the area where I add actions, I'm stuck. I know, this sounds stupid.
I chose start a program and set the program to "C:\Windows\System32\notepad.exe". I don't know what to put in the Arguments or Start in. I'm thinking I should put the path to the file, but that would just open it, right? I want it saved. I tried adding a -s /s or whatever but it doesn't seem to work.
Very interesting. Try moving file to itself by "cmd /c move file.txt file.txt". You are correct that opening file in notepad would need you to save it. however I would like to say no file, even if some changes being made to it, need to be saved. In my understanding if any application that is making change to the file is actually writing to it permanently.

Autostart Manycam with specific Images via configfile or parameter

At the moment I try to figure out if it is possible to start ManyCam automaticaly showing a picture i configure via a configuration file or via command line parameters.
I am afraid that this might be not possible so i also search for similary software as manycam, which enables this options. Additionally the software must run on windows.
The ManyCam Support answered: It is not possible right now to start ManyCam with parameters from command line.
The following command, when placed in a batch file, opens manycam when the batch file is clicked.
start "" "C:\Program Files (x86)\ManyCam\Bin\ManyCam.exe"

Resources