Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Standard Windows batch script not working

26 Nov 2010   #1
Vuldimort

Windows 7 Ultimate
 
 
Standard Windows batch script not working

I am trying to run a simple shutdown script..easy no big deal
shutdown -r -t 00
And I created a desktop shortcut and assigned a hot key to it to speed up the process.

Problem is I try to launch the batch script and instead I get a command prompt window that goes to the script directory, types / activates CMD then does nothing? Prior doing this in XP worked like a charm, why does it not work in Windows 7? I also tried to run the script as administrator AND checked permissions and took ownership and also tried running it in compatability mode, still no luck.

Please help.


My System SpecsSystem Spec
.
26 Nov 2010   #2
CyberZeus

Windows 7 Ultimate x64 SP1 clean install
 
 

Hi and welcome to Seven Forums!

Have you tried to run shutdown at a command prompt?
My System SpecsSystem Spec
26 Nov 2010   #3
PooMan UK

Windows 7 Ultimate 64bit
 
 

Just pressing the power button once on the pc does the same thing, wouldn't this be just as quick ? .... just a thought
My System SpecsSystem Spec
.

26 Nov 2010   #4
Dzomlija

Windows 7 Ultimate x64
 
 

Try creating a shortcut on the desktop that does not use a batch file:

1) Right-Click an unused part of the desktop, click "New", Click "Shortcut":
Name:  Image2.jpg
Views: 4
Size:  72.0 KB

2) Use "C:\Windows\System32\shutdown.exe /p" (without quotes) as the location of the item, then click "Next". You will obviously use your own desired parameters for the SHUTDOWN command instead of /p:
Name:  Image3.jpg
Views: 4
Size:  51.8 KB

3) Type a name for the shortcut, then click "Finish":
Name:  Image4.jpg
Views: 3
Size:  40.9 KB

4) Open the properties of the newly created shortcut, and change the shortcut key and/or icon according to your own desire:
Name:  Image1.jpg
Views: 6
Size:  54.0 KB

I use this to force an emmidiate shutdown of Windows if I don't want to install updates first...


My System SpecsSystem Spec
26 Nov 2010   #5
SledgeDG

Windows 7 Ultimate x86
 
 

Not really helpful in your case but the shutdown command would be
shutdown.exe –s –t 00
-r is reboot.
-DG
My System SpecsSystem Spec
26 Nov 2010   #6
unifex

Windows 7 Ultimate (x64)
 
 

Your command worked fine in my system (i.e. re-booted it) - I simply typed it into the command prompt. Thus it should work, except it's possible that in your system execution of batch files is somehow restricted - by analogy with PowerShell scripts which are restricted by default. Check your Group Policy settings.
My System SpecsSystem Spec
Reply

 Standard Windows batch script not working




Thread Tools




Similar help and support threads
Thread Forum
W10 TP : Old Windows Update Batch/Script
Hi, I need you for obtain a batch for apply this custom : Retrouvez votre bon vieux Windows Update sous Windows 10 - Le comptoir du hardware Can you help me ? Thanks Have a good day !
Windows Updates & Activation
How to run cmd.exe elevated in batch script
Hi All, I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below - set Elevation=elevate -wait cmd.exe /c %Elevation% "cd /d %CD% && xcopy /E /Y ...." %Elevation% "cd /d %CD% &&...
General Discussion
Windows 7 creating blank txt file after running a batch script
I have the following batch script @echo off setlocal enableextensions set "baseName=dnshistory" set "count=0" for /f "delims=%baseName%." %%a in (
General Discussion
batch script help
dear all any help to make batch script this the reason i want to make a batch file is to help me update the online games in 60 computers by overwriting or copying big files in one click from 1 source computer... instead of turning on all 60 computers and updating all online games, he'll just...
General Discussion
Admin privileges in batch script
Hallo, I wrote a Script that uninstalls an application, move some files and install an Application. The Script is working if I start it as Admin (right click - run as Admin ...). Everything works fine. But I want to have it working without the "run as". The script is only used in a...
Software
Help me with Batch script!
Hi, Can somebody assist me with a .bat file I am trying to create? This is what I have now: start /d "C:\Users\Me\Desktop\ghost" ghost.exe start /d "C:\Users\Me\Desktop" Poweroff.exe C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522The first 2 lines start...
Software


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:53.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App