Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Windows

Reply
 
LinkBack Thread Tools
Old 03-13-08   #1 (permalink)
Commodore 64
 
Poser's Avatar
 
amd nvidia

Join Date: Jan 2007
Location: Tampa
Posts: 1,075

Rep: 112 Poser is acknowledged by manyPoser is acknowledged by many
Unique Rep: 75
Folding Team Rank: 1063
Trader Rating: 2
Default Running .bat with adminsitrative privaledges

Recently, I have begun learning about writing simple scripts for common tasks and saving them as batch files. I have very limited experience and have encountered several issues.

1. The script "shutdown .bat" is simple enough, a timed shutdown. " shutdown /s /t 60". I have UAC disabled, so all cmd prompts are elevated. When I manually enter it @ the prompt it works flawlessly. However when I save it as .bat , create a shortcut pointing to is on the desktop and run it from there it goes bonkers:

it opens the command prompt at the desktop user level, and endlessly prints the script at C: i.e.

c:\"compname"\"user": shutdown \s \t 60

c:\"compname"\"user": shutdown \s \t 60
c:\"compname"\"user": shutdown \s \t 60
c:\"compname"\"user": shutdown \s \t 60
c:\"compname"\"user": shutdown \s \t 60

I have to break the operation to get it stop

2. As a result, I am pretty sure I have this running constantly in the background as if I run a different test script using the same technique... it still repeats the previous script over and over and over


So after reading a bunch on the net that hasnt worked at all... I was hoping for some guidance here.

Goals: execute the three following bat from desktop shortcut

"restart.bat" - shutdown /r
"shutdown.bat" - shutdown /s /t 60
"shutdowncancel.bat" - shutdown /a

Also I would like to know how to break the failed script


- much thanks from a newb
__________________
HOLY CRAP!!!
Its my first build/mod log...
***DELIDDING: A HOW NOT TO***
***DELIDDING pt2: A How to after how not to-ing***
pɐǝɥ ǝɥʇ uı ʎʞuoʍ sı ɹǝǝuoıd ...ʇsɐısnɥʇuǝ 939 ʇǝʞɔos

System: RUBIX n00b
CPU
Opty 175 ccbbe 0617 @ 1.46v
Motherboard
DFI NF4 Expert
Memory
4*1gig Gskill HZ
Graphics Card
8800 gts 640
Hard Drive
2 x WD cav 320 RAID 0
Sound Card
XiFi extreme gamer platnium
Power Supply
PP&C 750w silence
Case
CM STACKER RBX edition
CPU cooling
Thermal Right ultra 120/ silenx 90cfm
GPU cooling
stock
OS
Vista Ulti x64/ XP pro x 64
Monitor
ViewSonic 22"
Poser is offline I fold for Overclock.net   Reply With Quote
Old 03-13-08   #2 (permalink)
4.0ghz
 
Havegooda's Avatar
 
intel ati

Join Date: Sep 2007
Location: Seaside, CA
Posts: 4,339
Blog Entries: 1

Rep: 270 Havegooda is a proven memberHavegooda is a proven memberHavegooda is a proven member
Unique Rep: 192
Folding Team Rank: 135
Trader Rating: 16
Default

Don't you have to add some type of stop command a line below the shutdown request?

~Gooda~
__________________
If you need any help to do with Folding (or Intel), feel free to PM me ANYTIME.
Start folding HERE!
Quote:
Originally Posted by GoHigh View Post
All that work in my bathroom for three hours and for what... 2c. All that stroking... back and forth...
Havegooda on OCN and [H]

System: Water Cooled Quad (in progress)
CPU
Q6600 Engineering Sample
Motherboard
DFI DK X48
Memory
2x2GB G.Skill DDR2-1000
Graphics Card
4870x2
Hard Drive
4x640GB WD AALS - RAID5
Sound Card
Onboard
Power Supply
1200W Thermaltake Modular
Case
RocketFish (Lian-Li) by Cyberdruid
CPU cooling
D-Tek Fusion V2
GPU cooling
XPSC Full Cover
OS
Vista Ultimate x64
Monitor
Samsung 245BW (24")
Havegooda is offline I fold for Overclock.net Overclocked Account   Reply With Quote
Old 03-13-08   #3 (permalink)
Networking Nut
 
intel nvidia

Join Date: Apr 2006
Location: Finland
Posts: 614

Rep: 31 Microx256 is acknowledged by some
Unique Rep: 27
Folding Team Rank: 400
Trader Rating: 0
Default

Quote:
Originally Posted by Poser View Post
Recently, I have begun learning about writing simple scripts for common tasks and saving them as batch files. I have very limited experience and have encountered several issues.

1. The script "shutdown .bat" is simple enough, a timed shutdown. " shutdown /s /t 60". I have UAC disabled, so all cmd prompts are elevated. When I manually enter it @ the prompt it works flawlessly. However when I save it as .bat , create a shortcut pointing to is on the desktop and run it from there it goes bonkers:

it opens the command prompt at the desktop user level, and endlessly prints the script at C: i.e.

c:"compname""user": shutdown s t 60

c:"compname""user": shutdown s t 60
c:"compname""user": shutdown s t 60
c:"compname""user": shutdown s t 60
c:"compname""user": shutdown s t 60

I have to break the operation to get it stop

2. As a result, I am pretty sure I have this running constantly in the background as if I run a different test script using the same technique... it still repeats the previous script over and over and over


So after reading a bunch on the net that hasnt worked at all... I was hoping for some guidance here.

Goals: execute the three following bat from desktop shortcut

"restart.bat" - shutdown /r
"shutdown.bat" - shutdown /s /t 60
"shutdowncancel.bat" - shutdown /a

Also I would like to know how to break the failed script


- much thanks from a newb
ctrl + C and then usually you need to press 'y' as 'yes' to break a script

and what does the *.bat script look like? is there only this exactly as it is in it?
Code:
shutdown /s /t 60
because i just tried it, and it worked fine for me
and when playing with shutdown scripts, always remeber
shutdown /a
cancels the scheduled shutdown

and little tips for making scripts;
adding a @ at the beginning of a line hides the path and command in the CMD, but thows the message of the command, and with & you can make multiple commands on one line, for example you can make
Code:
cls
ipconfig /all
pause
exit
as
Code:
cls&ipconfig /all&pause&exit
__________________
Quote:
Originally Posted by Stormhammer View Post
...pulled my CPU to change the fans and thats when I discovered thermal paste got EVERYWHERE but on the actual CPU

System: The Quiet Sleeper
CPU
Intel Core 2 Quad Q6600
Motherboard
ASUS P5KC
Memory
3072MB (1024+1024+1024) [3x2^10]
Graphics Card
Bliss 8800 GT GS 512MB + 7300GS (for Quadscreen)
Hard Drive
320GB + 200GB (both are SATAII)
Sound Card
Integrated 8-Channel HD Audio
Power Supply
Nexus NX-4090, 400w
Case
Nexus Breeze 400 Mid-Tower
CPU cooling
AC Freezer 7 Pro
GPU cooling
Modded Golden Sample Cooler
OS
Windows Vista Ultimate x86
Monitor
Quadscreen Setup, total res. 5440x1200
Microx256 is offline I fold for Overclock.net   Reply With Quote
Old 03-13-08   #4 (permalink)
Commodore 64
 
Poser's Avatar
 
amd nvidia

Join Date: Jan 2007
Location: Tampa
Posts: 1,075

Rep: 112 Poser is acknowledged by manyPoser is acknowledged by many
Unique Rep: 75
Folding Team Rank: 1063
Trader Rating: 2
Default

@microX...

still a no go... and the script is exactly as you have reproduced it above.

perhaps it is an issue exclusive the 64bit flavor... where security is tighter???

see attached pic
Attached Thumbnails
running-bat-adminsitrative-privaledges-scriptf.jpg  
__________________
HOLY CRAP!!!
Its my first build/mod log...
***DELIDDING: A HOW NOT TO***
***DELIDDING pt2: A How to after how not to-ing***
pɐǝɥ ǝɥʇ uı ʎʞuoʍ sı ɹǝǝuoıd ...ʇsɐısnɥʇuǝ 939 ʇǝʞɔos

System: RUBIX n00b
CPU
Opty 175 ccbbe 0617 @ 1.46v
Motherboard
DFI NF4 Expert
Memory
4*1gig Gskill HZ
Graphics Card
8800 gts 640
Hard Drive
2 x WD cav 320 RAID 0
Sound Card
XiFi extreme gamer platnium
Power Supply
PP&C 750w silence
Case
CM STACKER RBX edition
CPU cooling
Thermal Right ultra 120/ silenx 90cfm
GPU cooling
stock
OS
Vista Ulti x64/ XP pro x 64
Monitor
ViewSonic 22"
Poser is offline I fold for Overclock.net   Reply With Quote
Old 03-13-08   #5 (permalink)
Networking Nut
 
intel nvidia

Join Date: Apr 2006
Location: Finland
Posts: 614

Rep: 31 Microx256 is acknowledged by some
Unique Rep: 27
Folding Team Rank: 400
Trader Rating: 0
Default

Quote:
Originally Posted by Poser View Post
@microX...

still a no go... and the script is exactly as you have reproduced it above.

perhaps it is an issue exclusive the 64bit flavor... where security is tighter???

see attached pic
wait a sec.. is a bat file opening a bat file? because that usually causes trouble

you can always replace the command that opens the script with the commands from the script.. eg:

a.bat:

Code:
echo testas
pause
b.bat
pause
exit
b.bat:

Code:
echo shutting down
shutdown /S /T 60
so you can change that to
Code:
echo testas
pause
echo shutting down
shutdown /S /T 60
pause
exit
and still the effect is the same, except theres usually less errors then

oh.. and i noticed theres a $ in the path.. special marks like that are known to cause troubles sometimes, sp you can try to run it from a different folder also
__________________
Quote:
Originally Posted by Stormhammer View Post
...pulled my CPU to change the fans and thats when I discovered thermal paste got EVERYWHERE but on the actual CPU

System: The Quiet Sleeper
CPU
Intel Core 2 Quad Q6600
Motherboard
ASUS P5KC
Memory
3072MB (1024+1024+1024) [3x2^10]
Graphics Card
Bliss 8800 GT GS 512MB + 7300GS (for Quadscreen)
Hard Drive
320GB + 200GB (both are SATAII)
Sound Card
Integrated 8-Channel HD Audio
Power Supply
Nexus NX-4090, 400w
Case
Nexus Breeze 400 Mid-Tower
CPU cooling
AC Freezer 7 Pro
GPU cooling
Modded Golden Sample Cooler
OS
Windows Vista Ultimate x86
Monitor
Quadscreen Setup, total res. 5440x1200

Last edited by Microx256 : 03-13-08 at 04:10 PM.
Microx256 is offline I fold for Overclock.net   Reply With Quote
Old 03-13-08   #6 (permalink)
Commodore 64
 
Poser's Avatar
 
amd nvidia

Join Date: Jan 2007
Location: Tampa
Posts: 1,075

Rep: 112 Poser is acknowledged by manyPoser is acknowledged by many
Unique Rep: 75
Folding Team Rank: 1063
Trader Rating: 2
Default

the window behinds it is simply a cmd prompt I opened to demonstrate that the "cmd" command defaults to adminstrator priv.

the dollar sign is simply the user folder name... but I try running it from the base directory

edit: unfortunately changing the origin directory (folder) does not solve the problem. It simply enters the non-terminating loop. Yet it runs perfectly if I open a command prompt and manually enter the script ???
__________________
HOLY CRAP!!!
Its my first build/mod log...
***DELIDDING: A HOW NOT TO***
***DELIDDING pt2: A How to after how not to-ing***
pɐǝɥ ǝɥʇ uı ʎʞuoʍ sı ɹǝǝuoıd ...ʇsɐısnɥʇuǝ 939 ʇǝʞɔos

System: RUBIX n00b
CPU
Opty 175 ccbbe 0617 @ 1.46v
Motherboard
DFI NF4 Expert
Memory
4*1gig Gskill HZ
Graphics Card
8800 gts 640
Hard Drive
2 x WD cav 320 RAID 0
Sound Card
XiFi extreme gamer platnium
Power Supply
PP&C 750w silence
Case
CM STACKER RBX edition
CPU cooling
Thermal Right ultra 120/ silenx 90cfm
GPU cooling
stock
OS
Vista Ulti x64/ XP pro x 64
Monitor
ViewSonic 22"

Last edited by Poser : 03-13-08 at 04:58 PM.
Poser is offline I fold for Overclock.net   Reply With Quote
Old 03-13-08   #7 (permalink)
Commodore 64
 
Poser's Avatar
 
amd nvidia

Join Date: Jan 2007
Location: Tampa
Posts: 1,075

Rep: 112 Poser is acknowledged by manyPoser is acknowledged by many
Unique Rep: 75
Folding Team Rank: 1063
Trader Rating: 2
Default

shamless bump...

should a mod move this to coding (though it is simple scripting... so probably not)
__________________
HOLY CRAP!!!
Its my first build/mod log...
***DELIDDING: A HOW NOT TO***
***DELIDDING pt2: A How to after how not to-ing***
pɐǝɥ ǝɥʇ uı ʎʞuoʍ sı ɹǝǝuoıd ...ʇsɐısnɥʇuǝ 939 ʇǝʞɔos

System: RUBIX n00b
CPU
Opty 175 ccbbe 0617 @ 1.46v
Motherboard
DFI NF4 Expert
Memory
4*1gig Gskill HZ
Graphics Card
8800 gts 640
Hard Drive
2 x WD cav 320 RAID 0
Sound Card
XiFi extreme gamer platnium
Power Supply
PP&C 750w silence
Case
CM STACKER RBX edition
CPU cooling
Thermal Right ultra 120/ silenx 90cfm
GPU cooling
stock
OS
Vista Ulti x64/ XP pro x 64
Monitor
ViewSonic 22"
Poser is offline I fold for Overclock.net   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 03:55 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.30070 seconds with 9 queries