Solved

Windows 7 batch file

Posted on 2011-02-16
7
556 Views
Last Modified: 2012-08-14
I need to create a batch file for windows 7 but I'm not sure of the allusersprofile... He's the script.

MKDIR programdata\usb
xcopy /y RD.exe "programdata/USB"
xcopy /y garde.exe "allusersprofile%\programdata\microsoft\windows\startmenu\programs\startup
xcopy /y edrag.ini "Users\Public\"

cd\ "ALLUSERSPROFILE%\programdata\microsoft\windows\startmenu\programs\startup

START garde.exe

I'm not sure is this is the proper script.  Can someone advise???
0
Comment
Question by:WellingtonIS
  • 4
  • 3
7 Comments
 
LVL 6

Expert Comment

by:CrowaX
ID: 34909213
Your allusersprofile and programdata (if you are refering to the system one) should have the % on both sides.

example cd\ "%ALLUSERSPROFILE%\programdata\microsoft\windows\startmenu\programs\startup

and if you want the C:\programdata folder, the way you have the first and second line may work, but if it doesnt, change that one to MKDIR %programdata%\usb

Other than that it looks good at a glance.
0
 

Author Comment

by:WellingtonIS
ID: 34909228
I will try thanks
0
 

Author Comment

by:WellingtonIS
ID: 34909700
I get Does programdata\usb specify a file name or Directory f=file D-directory.  How do I put this in the script?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 6

Expert Comment

by:CrowaX
ID: 34909803
try changing it to C:\programdata\usb, or %programdata%\usb
If that doesnt work, then try adding echo d | in front of that part of the script. We did that on ours to specify directory.

echo d | xcopy /y RD.exe C:\programdata/USB

Also I just saw, you dont need the quotes around directory names that do not have a space in them, although I dont think it hurts to have them. But if you start the directory name with a quote, you have to finish it with one.
0
 
LVL 6

Accepted Solution

by:
CrowaX earned 500 total points
ID: 34909882
Found a few more flaws with your \ being the wrong way in the second line, and some others. Here is your working code, I just tested it on my machine. The only issue I get with it is that you need permissions to copy to the startup folder, so the batch file may need to be ran with admin rights.

MKDIR C:\programdata\usb
xcopy /y RD.exe "C:\programdata\USB"
xcopy /y garde.exe "%allusersprofile%\microsoft\windows\start menu\programs\startup\"
xcopy /y edrag.ini "C:\Users\Public\"
cd\ "%ALLUSERSPROFILE%\microsoft\windows\startmenu\programs\startup
0
 

Author Comment

by:WellingtonIS
ID: 34910013
thanks I'm trying it now.
0
 

Author Closing Comment

by:WellingtonIS
ID: 34910048
Just make sure you have a space between start and menu
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question