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 > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 07-10-09   #1 (permalink)
Folding Fanatic
 
nategr8ns's Avatar
 
amd nvidia

Join Date: Dec 2007
Location: New Maine, Pandora
Posts: 6,022

Rep: 206 nategr8ns is acknowledged by manynategr8ns is acknowledged by manynategr8ns is acknowledged by many
Unique Rep: 168
Folding Team Rank: 306
Trader Rating: 3
Default Variables in Batch/DOS file paths?

Yeah that's right, I'm still using DOS in this day and age.
Well, "still" isn't the right word, since I just started using it this morning. Before you recommend something else, I'm only using Batch because I knew a tiny bit about it and because it seemed to be the easiest way to manipulate files in Windows.

So, without further ado, here's where I need help:
Code:
COPY "C:\Users\%USERNAME%\Documents\VMC Themes\%THEME%.dll" "C:\Windows\ehome\ehres.dll"
I'm pretty sure its failing (with the error "The system cannot find the path specified) because of my use of the THEME variable in the file path/file name. I have also tried putting the DLLs in folders (with the names of the different THEME values) as in "C:\Users\%USERNAME%\Documents\VMC Themes\%THEME%\myfile.dll" to no avail.

What's an easy way to get around using the variable in the path? I already tried setting another variable to the full path and using COPY THEPATH "C:\etcetc"

Any other thoughts?

Oh, by the way, after I get this working I'm going to try to redo it in other languages or at least make a GUI for it and make it an exe (which I have absolutely no experience with, but I'll figure it out).

edit: if anybody knows the environment variable for the Documents folder in Vista, please let me know. I couldn't find it.

edit again: the only way I've found for the Documents variable is in the key "HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Explorer\Shell Folders
String value: Personal" but I don't know how to set another variable to this value.

I'm also running into another issue after I set the source folder to a constant: the destination of the file I'm copying, "C:\windows\ehome\ehres.dll," is protected by Windows Resource Protection. This is just getting more and more complicated... Even though I'm the admin, I can't drag-drop the file (even though I copied in ... What gives?! This is getting to be overly complicated...

System: Designed for Optyvation
CPU
Opteron 175 LCB9E
Motherboard
DFI NF4 Ultra-D
Memory
2x1GB GSkill 500mhz HZs
Graphics Card
EVGA 8800GT SC 512
Hard Drive
160GB + 120GB
Power Supply
Ultra X-Finity 600w
Case
AeroCool AeroEngine II <3
CPU cooling
ACFreezer 64 Pro
GPU cooling
AC Accelero S1 w/Dual Tri-Cool 120mm (low)
OS
XP Home
Monitor
Samsung 220WM 22" + LG f-Engine 17" (dual screen)
Overclock.net - 2009 Chimp Challenge Champions

Last edited by nategr8ns : 07-10-09 at 05:58 PM
nategr8ns is offline I fold for Overclock.net   Reply With Quote
Old 07-11-09   #2 (permalink)
4.0ghz
 
billbartuska's Avatar
 
intel nvidia

Join Date: Mar 2005
Location: Greater Chicagoland Area
Posts: 2,370

Rep: 300 billbartuska is a proven memberbillbartuska is a proven memberbillbartuska is a proven memberbillbartuska is a proven member
Unique Rep: 268
FAQs Submitted: 2
Trader Rating: 0
Default

Just from looking a the few snippets you wrote seems to indicate you're "jumping in with both feet". Start slow.
Instead of using a variables, use the actual username/filename.
When that works , switch to variables.

Variables are defined with the "set" command.
If I remember correctly, there's also a requirement to use double % signs when accessing variables????.

You may find learning and using the FOR (for-in-do) command easier for accomplishing your task.

As for avoiding Vista's security features, disable all you can.
__________________
EDGE ...if you're not on it, you're taking up too much space.

System: My System
CPU
Athlon FX-57
Motherboard
A8N32-Sli-Deluxe
Memory
TWINX2048-3200C2PT,2x1G
Graphics Card
6800GT (x2)
Hard Drive
Raptors (RAID0)
Sound Card
SB Live24 --> X-Fi Xtreme
Power Supply
PCP&C 1kw
Case
Lian Li PC-71 (W/Window)
CPU cooling
Stock Heatsink
GPU cooling
Stock Heatsink
OS
XP-sp3 (x2) & Win7
Monitor
2 X Samsung 915N

Last edited by billbartuska : 07-11-09 at 07:05 AM
billbartuska is offline Overclocked Account   Reply With Quote
Old 07-11-09   #3 (permalink)
Folding Fanatic
 
nategr8ns's Avatar
 
amd nvidia

Join Date: Dec 2007
Location: New Maine, Pandora
Posts: 6,022

Rep: 206 nategr8ns is acknowledged by manynategr8ns is acknowledged by manynategr8ns is acknowledged by many
Unique Rep: 168
Folding Team Rank: 306
Trader Rating: 3
Default

Quote:
Originally Posted by billbartuska View Post
Just from looking a the few snippets you wrote seems to indicate you're "jumping in with both feet". Start slow.
Instead of using a variables, use the actual username/filename.
When that works , switch to variables.

Variables are defined with the "set" command.
If I remember correctly, there's also a requirement to use double % signs when accessing variables????.

You may find learning and using the FOR (for-in-do) command easier for accomplishing your task.

As for avoiding Vista's security features, disable all you can.
Thanks, I figured that would be my best option. I can't figure out how to disable the Windows Resource Protection. I already disabled UAC (first step when installing Vista ).

System: Designed for Optyvation
CPU
Opteron 175 LCB9E
Motherboard
DFI NF4 Ultra-D
Memory
2x1GB GSkill 500mhz HZs
Graphics Card
EVGA 8800GT SC 512
Hard Drive
160GB + 120GB
Power Supply
Ultra X-Finity 600w
Case
AeroCool AeroEngine II <3
CPU cooling
ACFreezer 64 Pro
GPU cooling
AC Accelero S1 w/Dual Tri-Cool 120mm (low)
OS
XP Home
Monitor
Samsung 220WM 22" + LG f-Engine 17" (dual screen)
Overclock.net - 2009 Chimp Challenge Champions
nategr8ns is offline I fold for Overclock.net   Reply With Quote
Old 07-12-09   #4 (permalink)
4.0ghz
 
billbartuska's Avatar
 
intel nvidia

Join Date: Mar 2005
Location: Greater Chicagoland Area
Posts: 2,370

Rep: 300 billbartuska is a proven memberbillbartuska is a proven memberbillbartuska is a proven memberbillbartuska is a proven member
Unique Rep: 268
FAQs Submitted: 2
Trader Rating: 0
Default

Quote:
Originally Posted by nategr8ns View Post
Thanks, I figured that would be my best option. I can't figure out how to disable the Windows Resource Protection. I already disabled UAC (first step when installing Vista ).
You have to "take ownership" of the file. Then you can change the ACL settings to full control.

Google will tell you how.

It's the same idea, but a slightly different procedure for registry entries.
__________________
EDGE ...if you're not on it, you're taking up too much space.

System: My System
CPU
Athlon FX-57
Motherboard
A8N32-Sli-Deluxe
Memory
TWINX2048-3200C2PT,2x1G
Graphics Card
6800GT (x2)
Hard Drive
Raptors (RAID0)
Sound Card
SB Live24 --> X-Fi Xtreme
Power Supply
PCP&C 1kw
Case
Lian Li PC-71 (W/Window)
CPU cooling
Stock Heatsink
GPU cooling
Stock Heatsink
OS
XP-sp3 (x2) & Win7
Monitor
2 X Samsung 915N
billbartuska is offline Overclocked Account   Reply With Quote
Old 07-12-09   #5 (permalink)
Folding Fanatic
 
nategr8ns's Avatar
 
amd nvidia

Join Date: Dec 2007
Location: New Maine, Pandora
Posts: 6,022

Rep: 206 nategr8ns is acknowledged by manynategr8ns is acknowledged by manynategr8ns is acknowledged by many
Unique Rep: 168
Folding Team Rank: 306
Trader Rating: 3
Default

Quote:
Originally Posted by billbartuska View Post
You have to "take ownership" of the file. Then you can change the ACL settings to full control.

Google will tell you how.

It's the same idea, but a slightly different procedure for registry entries.
Thanks, I have ownership now. +
I still can't delete the file manually or overwrite it with my script. I'm not 100% sure how to change the ACL settings, so that's probably it.

System: Designed for Optyvation
CPU
Opteron 175 LCB9E
Motherboard
DFI NF4 Ultra-D
Memory
2x1GB GSkill 500mhz HZs
Graphics Card
EVGA 8800GT SC 512
Hard Drive
160GB + 120GB
Power Supply
Ultra X-Finity 600w
Case
AeroCool AeroEngine II <3
CPU cooling
ACFreezer 64 Pro
GPU cooling
AC Accelero S1 w/Dual Tri-Cool 120mm (low)
OS
XP Home
Monitor
Samsung 220WM 22" + LG f-Engine 17" (dual screen)
Overclock.net - 2009 Chimp Challenge Champions

Last edited by nategr8ns : 07-12-09 at 01:27 PM
nategr8ns 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 -5. The time now is 07:54 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.19169 seconds with 8 queries