Solved

Windows 7 batch file

Posted on 2011-02-16
7
560 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

632 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