[windows-7] auto run a bat script in windows 7 at login

I have recently acquired a windows 7 laptop from my late grandmother. I have been using it for work and other things. I decided to create a VM using VirtualBox And now I want to create a user on the (Windows 7 Host) machine so that when I log into that user it autoruns a .bat script to start the VM. To make it clear I only want to run it only if the user "VM" logs in and not my normal user and it would be super awesome if it would autostart in full screen. I have a shortcut on my desktop that executes the command:

"C:\Program Files\Oracle\VirtualBox\VirtualBox.exe" --comment "VM" --startvm "12dada4d-    9cfd-4aa7-8353-20b4e455b3fa"

but how do I make an autorun.bat when I log into the User "VM"?

This question is related to windows-7 batch-file virtual-machine autorun

The answer is


I hit this question looking for how to run batch scripts during user logon on a standalone windows server (workgroup not in domain). I found the answer in using group policy.

  1. gpedit.msc
  2. user configuration->administrative templates->system->logon->run these programs at user logon
  3. add batch scripts.
  4. you can add them using cmd /k mybatchfile.cmd if you want the command window to stay (on desktop) after batch script have finished.
  5. gpupdate - to update the group policy.

Just enable parsing of the autoexec.bat in the registry, using these instructions.

:: works only on windows vista and earlier 
Run REGEDT32.EXE.
Modify the following value within HKEY_CURRENT_USER: 

Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ParseAutoexec 

1 = autoexec.bat is parsed
0 = autoexec.bat is not parsed

Examples related to windows-7

ng is not recognized as an internal or external command Why am I getting ImportError: No module named pip ' right after installing pip? How to Delete node_modules - Deep Nested Folder in Windows Telnet is not recognized as internal or external command Multiple -and -or in PowerShell Where-Object statement How do I set ANDROID_SDK_HOME environment variable? Run Batch File On Start-up Why isn't .ico file defined when setting window's icon? How to access shared folder without giving username and password Can't start hostednetwork

Examples related to batch-file

'ls' is not recognized as an internal or external command, operable program or batch file '' is not recognized as an internal or external command, operable program or batch file XCOPY: Overwrite all without prompt in BATCH CanĀ“t run .bat file under windows 10 Execute a batch file on a remote PC using a batch file on local PC Windows batch - concatenate multiple text files into one How do I create a shortcut via command-line in Windows? Getting Error:JRE_HOME variable is not defined correctly when trying to run startup.bat of Apache-Tomcat Curl not recognized as an internal or external command, operable program or batch file Best way to script remote SSH commands in Batch (Windows)

Examples related to virtual-machine

virtualbox Raw-mode is unavailable courtesy of Hyper-V windows 10 How to install Guest addition in Mac OS as guest and Windows machine as host How do I delete virtual interface in Linux? Bridged networking not working in Virtualbox under Windows 10 How to enable copy paste from between host machine and virtual machine in vmware, virtual machine is ubuntu VirtualBox: mount.vboxsf: mounting failed with the error: No such device What does the DOCKER_HOST variable do? VBoxManage: error: Failed to create the host-only adapter How to export a Vagrant virtual machine to transfer it installing vmware tools: location of GCC binary?

Examples related to autorun

auto run a bat script in windows 7 at login Run script with rc.local: script works, but not at boot