Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Windows Variable Help...
Old 06-12-2007, 12:51 AM Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Hi,

Can someone tell me if this is a valid windows variable? %DISK_DRIVE% (I Found it in google, but not much is listed)

If so, could that be used in a batch file to copy/delete files? For example

copy file.ext %disk_drive%
delete file.exe %disk_drive%

Thanks
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-12-2007, 12:09 PM Re: Windows Variable Help...
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
No idea. That's really ancient technology, I don't think you're going to find many people on a web forum who've used DOS variables in a long time.

Have you tried it? Just the copy statement? I don't think you need a second argument for delete?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 01:28 PM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Quote:
Have you tried it? Just the copy statement? I don't think you need a second argument for delete?
I tried it this:

Code:
copy file.ext %disk_drive%:\
Which in my mind would be:

copy file.exe to any drive that exists...But I am pretty sure I am wrong...But I know it 'works' somewhat because I don't get an error message, just a blank where the drive letter 'should be' so the end result would be...

Code:
copy file.exe  :\
And of course the error renders out to be no drive specified, or something to that effect, but its not working and I want that to work.
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 01:45 PM Re: Windows Variable Help...
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Does it have to be a batch file?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 01:58 PM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
No, it doesn't have to be a batch file
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 06:49 PM Re: Windows Variable Help...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Anybody, when coding batch files can define Environment Variables which can be called in batch commands.

To see the standard ones, RC on "My Computer", choose Properties, open the Advanced tab and click the "Environment Variables ... " button.

From there you can edit them, delete them or create your own. Even in Windows XP you can edit autoexec.bat and define them there.

For the registry:
the System variables can be found in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Session Manager\Environment

and the user variables are in

HKEY_CURRENT_USER\Environment
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-13-2007, 04:37 AM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Ok,

I guess I wasn't specific enough...

What I want to do is be able to copy / move / delete files across any hard drive on any of my pc's...So for example...If I had 3 computers with two hard drives in each machine, how could I copy files to all of those machines' hard drives in one shot? I was thinking that if I used some sort of file to accomplish this, that would make it automatic in the sense that I could run that file, and it's done. Instead of having to run it at each pc...

Thanks
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 06-13-2007, 09:40 AM Re: Windows Variable Help...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It should be possible to do this using a batch file, it's basically a file replication or multiple backup routine that you need to write.

You would need to know the NETBIOS (WINS) names of the recipient machines and the target folder would have to be shared so the scripts could reference the UNC path to the folder \\MACHINE_NAME\SHARE_NAME

Why can you not process this the other way around and have the files on a network share with a mapped drive letter on the other machines?
That way there is only one copy to be updated.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-13-2007, 10:33 AM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Hey Chris,

How do you code an alert window in a batch file? For example to display a js message alert with the following in it. This would have to be in a batch file.

Code:
Operation Complete
Quote:
Why can you not process this the other way around and have the files on a network share with a mapped drive letter on the other machines?
That way there is only one copy to be updated.
Yep, that's what I am going to do

Thanks alot!
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 06-13-2007 at 10:34 AM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 06-13-2007, 11:53 AM Re: Windows Variable Help...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
If the Messenger service is running you can do

net send MACHINE_NAME | USERNAME message

or you can use the pause command :

pause Operation Complete

this will output

Quote:
C:> Operation Complete
Press any key to continue ...
at the command prompt.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-13-2007, 12:32 PM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
I thought the idea of messenger popup window...But there's no way to do a javascript like this from a batch file?

Code:
alert ("This is a Javascript Alert")
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 06-13-2007, 01:36 PM Re: Windows Variable Help...
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Batch files don't run javascript. I think the technology is about 15 years older.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-14-2007, 04:12 AM Re: Windows Variable Help...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
You mean a windows batch file couldn't do it using an array? Didn't think so, but I just thought may it *could* be done this way.
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Windows Variable Help...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.50846 seconds with 12 queries