Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows 7 batch file

Posted on 2011-02-16
7
Medium Priority
?
565 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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). …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

916 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