How to do this? Read me!

February 2, 2011 at 10:51:24
Specs: Windows 7
I want to make a batch program that does 2 simple things
i will describe this as simple as i can.
There are 2 files, both in the same folder! 1 is the batch file i need your help for, the second is a file called file2.ini
The files will be downloaded in a folder, and when you run the batch file it will need to do 2 things, 1. delete a file that is already on your computer (got the code: del "PATH") and the second is move the file (file2.ini) you just downloaded to a folder that does exist already (C:/windows) but how can i do that? The move command is simple:
move "FROM" "TO"
but what do i need to type in in FROM? Because it has the be the folder where the file is in, but i dont know where people have it, because the file is downloaded. maybe C:/users/downloads ore something. So isnt there something like:
move "*CURRENT LOCATION*/file2.ini" "c:/windows".
the batch file knows the current location of the file2.ini because it is in the same folder as file2.ini! U guys understand? Please help, i think its simple but im not good with this things!

See More: How to do this? Read me!

Report •


#1
February 2, 2011 at 12:04:15
How to do this? Read me!
How do you read yourself? I don't know. Try a mirror.

move "*CURRENT LOCATION*/file2.ini" "c:/windows"
My Windows is on my E: drive. Now what do you do?

How To Ask Questions The Smart Way


Report •

#2
February 2, 2011 at 12:15:46
%userprofile%\downloads\file2.ini

Remember this will only work if they use IE and if they leave IE's default settings. If they use Firefox or Crome then it will not work.

Just wondering, what is it that is using INI files. This is like old school. Every think uses the registry these days.


Report •

#3
February 2, 2011 at 14:54:31
Ace and Rozer, I guess he mentioned Both (Ini and Bat) file will be downloaded by the user and then the batch file will executed. Any thoughts ?

He can simply use Move FIlename Destination. As the batch file will get executed from the same directory it will be able to locate both the files..

@Levikok : Note that If HKEY_CURRENT_USER\Software\Microsoft\Command Processor\ key contains a value name Autorun with some data then it will not work.

This key is where command processor looks first before doing anything.

Subhash Chandra.
www.s-chandra.co.cc


Report •

Related Solutions

#4
February 2, 2011 at 16:32:04
subhash chandra: Any thoughts ?
Well, I he's assuming I have a C:\Windows, and I don't. I'm considering that the bigger problem here.

EDIT: He's also assuming I have write access to my Windows folder. That's probably an even bigger problem.

How To Ask Questions The Smart Way


Report •

#5
February 2, 2011 at 18:24:28
Of-cource Rozer Both are bigger problems.
I agree he/anyone should not move files to C:\windows directory like that .


however i am talking about below from his lines.


There are 2 files, both in the same folder! 1 is the batch file i need your help for, the second is a file called file2.ini The files will be downloaded in a folder.....

so, If their users are going to download 2 files (1 ini and 2nd the batch fie itself ) in "a" folder and execute "that" bat file then it wont be difficult for that batch file to recognize that folder and then move that Ini file as both are in same folder.

Please correct me if i am assuming him wrong way..


Subhash Chandra.
www.s-chandra.co.cc


Report •

#6
February 3, 2011 at 01:44:16
I got it, its just %~dp0
i can call it by doing
%~dp0\file2.ini

so code will look like this
move "%~dp0\file2.ini" "c:\windows"

am i right?


Report •

#7
February 3, 2011 at 05:08:11
move file2.ini c:\windows
or what u written both
should work,however i will highly recommend not to use windows folder,use some other or create a new folder

Subhash Chandra.
www.s-chandra.co.cc


Report •

Ask Question