Running Batch File when Windows Vmware boots up - batch-file

I need to run a batch file whenever my Windows 10 VMware boots up ..i have tried the scheduler and put the exe path in the start up folder but it appears that works only when the user logs into the Vmware and not when the Vmware is booting up.
has any of you already solved this ?? if yes, how ?

Task Scheduler comes with an option called "System Startup". This means when both Windows and Task Scheduler successfully started up.
You should select When the computer starts for trigger. And run a program for action. Fill in the path to your script and arguments if necessary.

Related

Task Scheduler Runs Batch File - Batch File Only Works Partially?

My batch file is very simple. It starts a program, and echos "I ran" into a .txt file to prove that it ran for testing purposes. The settings for my Task Scheduler task are below:
General:
- Run whether user is logged in or not.
- Run with highest privileges
- Configure for Windows 7, Windows Server 2008 R2
Trigger:
-At startup, 15 min delay
Action:
- Start a Program
- Program/Script: STARTRDM.BAT
- Add arguments (optional): blank
- Start in (optional): C:\Scripts\
Conditions: None
Settings:
- Allow task to be run on demand
- Stop the task if it runs longer than 1 hour
- If the running task does not end when requested, force it to stop
- If the task is already running, , do not start a new instance.
STARTRDM.BAT
>>log.txt echo I RAN
start C:\"Program Files (x86)"\Devolutions\"Remote Desktop Manager"\RemoteDesktopManager64.exe`
If I double click the batch file, it starts the program as expected and also writes to the .txt file. If I run the batch file through the Task Scheduler, the .txt is appended to as expected but the program is not started. This is driving me crazy!
Well, I figured it out so I thought I'd post the solution.
The station I was working on is set up as a Kiosk. The Kiosk account is what is usually logged in on this system. I was using a separate Admin account to author the tasks in Task Scheduler because Kiosk didn't have the necessary permissions. By default the field, "When running this task, use the following user account:" gets set to whichever account you are running Task Scheduler as. When I switched this field to the Kiosk user, it fixed my problem.

Using Task Scheduler to run a batch file that contains the start /w command

I have a Windows XP virtual machine that I am using to run a legacy app. I am using a limited user account.
I have created a batch file that I'd like to:
Start the legacy app
Wait for the program in step 1 to close
Shut down the computer
So this is the code I am using (in this example, I am attempting to open notepad):
#ECHO OFF
start /w notepad
%windir%\system32\shutdown.exe -f -s -t 1
Because the legacy app needs to be run under an account with administrator privileges, I then manually created a scheduled task in Task Scheduler to run the batch file. The scheduled task is set to run using an account named Admin that has administrator privileges.
I am having a bit of an issue. When the scheduled task runs, nothing appears on the screen. However, I did notice that both cmd.exe and notepad.exe appear in Task Manager as processes running as the user Admin.
What am I doing wrong? How can I accomplish what I'd like to do? Thanks!
Sorry all, it was an issue with me not having Task Scheduler set up properly. I found this post which suggests to use the AT command to run the task interactively. This allows the Cmd window to be displayed when a batch file is run as a Scheduled Task.

Launch a Batch file from another computer using Command Line

I have a computer on which I have a server running. The computer has no screen attached to it and is running 24/7.
If the server crashes or something like that I want to be able to start it again without having to connect a screen to it.
Can I start the .bat file from the cmd on my other computer? If so, am I able to see the logs from the server on my other computer(the one with screen)?
Both computers are running Windows.
I solwed it using the RDC tool. It works great!

Batch file's Core FTP line is Not running during Scheduled Task. Works if started Manually

I have a simple batch file which needs to be run weekly to upload some files via Core FTP.
I'm using the free version of Core FTP LE.
MySavedProfile is the Site Name of the saved profile I created using Core FTP's site Manager. The profile contains the URL / credentials / etc of the site to connect to.
Here are the contents of the batch file:
SET logf=confirm.log
echo test-start >> %logf%
"C:\Progra~1\CoreFTP\coreftp.exe" -B -s -pasv -O -site MySavedProfile -u "C:\Progra~2\PathToFiles\FileToUpload.txt"
echo test-finish >> %logf%
For the Windows Server 2012 r2 Task Scheduler, I have created a basic, weekly scheduled task on the Task Scheduler Library root which runs the batch file. For this scheduled task I have:
(Under the General tab)
"Run whether user is logged on or not" is selected
"Run with highest privileges" is checked
Configure for = Windows Server 2012 R2
(Under Actions)
Action = Start a program
Program / Script = "C:\Progra~2\PathToFiles\batch.bat"
Start in = C:\Progra~2\PathToFiles\
Here is the weird behavior I am getting:
If I double click on the batch file directly, it works fine and uploads the text file via Core FTP just fine.
However, if I try to let the Windows Task Scheduler run it, it runs everything except the Core FTP line. That is, I get the usual:
test-start
test-finish
in the confirm.log file, but the FileToUpload.txt has not been uploaded to the remote server, and there are no errors from CoreFTP that I can detect.
I have tried this with a service account that has permissions to run batch files, as well as my own account for this scheduled task. I get the same result: it doesn't seem to run that CoreFTP line. At least not via Task Scheduler. I need this upload to be automated.
I've searched Core FTP's documentation, Google, etc. No one seems to have run into this exact issue. I've applied recommendations from distantly related issues, but none of them have worked.
Any help would be greatly appreciated. Thank you.
The only way to do this is to use the full version of Core FTP (that is Core FTP Pro). If you use the LE version you have to check the "Run only when user is logged on" option.
This happens because of the splash screen at the beginning.
If you can't be logged on forever you could create a user that will always be logged on just for these tasks.
Remember to use the -Log option on CoreFTP to check if it is actually doing something.

Running batch files on Windows 7 that were created on XP

I am having trouble running batch files on Windows 7 that I created, and which run properly as Scheduled Tasks, on XP. When I run these batch files as Scheduled Tasks on Windows 7, the command window just closes quickly. The batch files actually consist of a wrapper that initiates another batch file that contains branching and call Python scripts - so it's a little complicated.
I'm comparing differences between my Windows 7 and XP machines. When I run these batch files on XP, the top bar in the command window says C:\WINDOWS\SYSTEM32\SVCHOST.EXE. I set up a simple batch file (that doesn't contain a wrapper, branching or Python scripts) on the Windows 7 computer and at the top it says taskeng.exe, please see capture below.
Does anyone have a suggestion on what I need to do to get the batch files running on Windows 7 as scheduled tasks? Maybe there's something missing from my Environment Variables? I have checked the paths and everything in my more complicated batch files that I transferred to Windows 7 - I should say I can get the batch files running when I actually navigate to folder containing batch files I created. I really need them to run as Scheduled Tasks. I'm not particularly savvy with batch files, but these were running really well for 1+ year on my XP computer. Thank you! Patty
On Windows 7 when creating a a Scheduled Task you can choose 'Start In' you can then change the location in which it is run (and the directory to file you are refering to within your batch file.) This is worth trying before checking other things.
Second I would check what permissions it is being run with on Task Scheduler, run it as administrator to rule this out.
I would also see what happens when you just double click on the batch file as a logged in user and go forward from that.

Resources