Solved

Windows 7 batch file

Posted on 2011-02-16
7
553 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
OfficeMate Freezes on login or does not load after login credentials are input.
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…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now