Issues running .bat files

Jlevitt

New member
Local time
3:47 PM
Messages
3
I am having a lot of difficulty running batch files. I simply want to create a runonce logon script that will install my .reg file I have created for every user who creates an account on this computer. My file is called c:\tweaks.reg. The file works fine when I double click it or run from command line using regedit /s c:\tweaks.reg.
When I enter this into a batch file to link to my run once script, it does not work.
The problem is command prompt appears and disappears instantly without executing the .reg file.
@echo off
regedit /s c:\tweaks.reg

What am I doing wrong? This is happening on both of my Windows 7 systems and one is a fresh installation. Thanks in advance!

I should note the .bat file is not working running it alone (before putting it into the run once script) so this is not an error in the .reg or the run once script.
 

My Computer

OS
Windows 7 x64 Professional
Have you saved the .bat file to notepad? Have you right clicked it and chosen to run as Administrator?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Bruce ... somewhere in his 40's
OS
Windows 7 Ultimate 32bit SP1
CPU
Intel(R) Core(TM)2 Quad CPU @ 2.40GHz, 2400 MHz
Motherboard
INTEL/D975XBX2
Memory
4 GB
Graphics Card(s)
ATI Radeon HD 2600 Pro
Monitor(s) Displays
Samsung SyncMaster 914v
Screen Resolution
1280 x 1024
Hard Drives
2/500GB each ... ST3500630AS ATA Device.
One is not connected
PSU
Rocketfish 700 W
Case
G.Skill Gigabyte Chassis
Keyboard
Standard PS/2 Keyboard
Mouse
Microsoft PS/2 Mouse
Internet Speed
DSL
Antivirus
Avira Internet Security
Browser
IE 11
Other Info
ATI HDMI Audio
Hello Jlevitt, and welcome to Seven Forums.

You could also change the registry settings directly with the batch file instead of trying to run the REG file with the batch file.

You could type reg add /? in a commmand prompt to see the full usage.

Reg Add "reg-key" /v ValueName /t TypeOfValue /d DataForValue /f


If you like, you can edit the BAT files in OPTION THREE of the tutorial below as an example to help.

Taskbar - Lock or Unlock in Windows 8 - Windows 8 Forums

Hope this helps,
Shawn
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Thank you for your response. Yes I saved it as a .bat file after creating it in notepad. I have tried running it as administrator as well to no avail. I have noticed that even trying something as simple as opening cmd.exe with a .bat file does not work either. It pops up briefly and disappears instantly. Example:
@echo off
c:\windows\system32\cmd.exe

I would have to assume there is something set in windows that is preventing execution of a .bat file. This computer is not part of a domain and it was a fresh install. Any ideas?
 

My Computer

OS
Windows 7 x64 Professional
Brink,

Thanks for your response but the issue seems to be that I am unable to execute anything. I have tried your suggestion as well. I have even copied examples of registry commands from other forums to test. The commands work fine if run from cmd.exe, but they do not work from a .bat file.
 

My Computer

OS
Windows 7 x64 Professional
Back
Top