-1

Hi I have the following BAT file all works well except for lines 70 and 78 can anybody help

Tnx-

    @ECHO OFF

; Reseting system color configuration...
@COLOR 17

ECHO ===============================
ECHO == AUTOCAD 2010 De Mar Setup ==
ECHO ===============================
ECHO.

ECHO Creating a backup directory, Please wait...
ECHO.

mkdir C:\"AUTOCAD 2010 BACKUP"

ECHO.
ECHO AUTOCAD 2010 BACKUP directory successfully created...
ECHO.

ECHO Backing up nessesary files, Please wait...
ECHO.

xcopy /s/y C:\"Program Files\AutoCAD 2010\Support\acad2010doc.lsp" C:\"AUTOCAD 2010 BACKUP"
xcopy /s/y C:\"Program Files\AutoCAD 2010\Support\acad.lsp" C:\"AUTOCAD 2010 BACKUP"
xcopy /s/y C:\"Program Files\AutoCAD 2010\Support\acad.pgp" C:\"AUTOCAD 2010 BACKUP"

ECHO.
ECHO Nessesary files successfully Backed-up...
ECHO.

ECHO Deleting conflicting files, Please wait...
ECHO.

del C:\"Program Files\AutoCAD 2010\Support\acad2010doc.lsp"
del C:\"Program Files\AutoCAD 2010\Support\acad.lsp"
del C:\"Program Files\AutoCAD 2010\Support\acad.pgp"

ECHO.
ECHO Obsoleate files successfully deleted...
ECHO.

ECHO Deleting old desktop shortcut, Please wait...

del /s/q/f C:\"documents and settings\AutoCAD 2010.lnk"

ECHO.
ECHO Obsoleate desktop shortcut successfully deleted...
ECHO.

ECHO Refreshing Desktop icons...
ECHO.

rundll32 user32.dll,UpdatePerUserSystemParameters

ECHO.
ECHO Desktop successfully refreshed...
ECHO.

ECHO Creating Customised Shortcut, Please wait...
ECHO.

cscript "C:\VBS\SHORTCUT.vbs"

ECHO.
ECHO Customised shortcut successfully created...
ECHO.

ECHO Deleting AutoCAD 2010 Startup icon, Please wait...

ECHO Deleating obsoleate De Mar 2010 Setup uninstall startup icon...

del /s/q/f C:\"Documents and settings\%USERSPROFILE%\Menu Start\Programs\Hendrika's AutoCAD Instellingen\Uninstall Hendrika's AutoCAD Instellingen.lnk"

ECHO.
ECHO De Mar 2010 Setup uninstall startup icon successfully deleted...
ECHO.

ECHO Copying the UNINSTAAL DE MAR 2010.bat to new location...

xcopy /s/y/f C:\"BAT\UNINSTAAL DE MAR 2010.bat" C:\"Documents and Settings\%ALLUSERSPROFILE%\Menu Start\Programma's\Hendrika's AutoCAD Instellingen\"

MSG * AutoCAD 2010 Setup sucesfully compleated, Enjoy!

to recap the lines of concern are:

del /s/q/f C:\"Documents and settings\%USERSPROFILE%\Menu Start\Programs\Hendrika's AutoCAD Instellingen\Uninstall Hendrika's AutoCAD Instellingen.lnk"

and

    xcopy /s/y/f C:\"BAT\UNINSTAAL DE MAR 2010.bat" C:\"Documents and Settings\%ALLUSERSPROFILE%\Menu Start\Programma's\Hendrika's AutoCAD Instellingen\"
philip
  • 345
  • 4
  • 5
  • 9
  • 2
    just one more thing you need to add. All problem reports should have what you expect (which is pretty obvious here) _and_ what is actually happening (which is missing). In what way are they failing? – paxdiablo Feb 09 '11 at 13:19
  • Well there obviously not working, there not copying and deleating as i have asked them and the problem is I dont know why. If I knew that I wouldnt be here asking the question? – philip Feb 09 '11 at 13:31

3 Answers3

1

Probably the easiest thing to do is put an echo before both those lines, like:

echo del /s/q/f C:\"Docu ...

and put a:

pause

at the end so it waits for you to hit ENTER.

That should at least show you what the variable substitutions are doing within the script. I think what you may find is that %ALLUSERSPROFILE% is a full path name already and won't take kindly to being injected into the middle of another path:

C:\Documents and Settings\Pax\My Documents> echo %ALLUSERSPROFILE%
C:\Documents and Settings\All Users
C:\Documents and Settings\Pax\My Documents> echo %USERPROFILE%
C:\Documents and Settings\Pax

I think it's USERPROFILE by the way (singular), not the plural USERSPROFILE. At least that's how it is on my WinXP box.

I think you'll probably be able to fix it by using:

del /s/q/f "%USERSPROFILE%\Menu Start\Programs\Hendrika's AutoCAD Instellingen\Uninstall Hendrika's AutoCAD Instellingen.lnk"

and:

xcopy /s/y/f C:\"BAT\UNINSTAAL DE MAR 2010.bat" "%ALLUSERSPROFILE%\Menu Start\Programma's\Hendrika's AutoCAD Instellingen\"
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • Perhaps I got the count wrong (I include blank lines) see edit for the lines of concern sorry – philip Feb 09 '11 at 13:15
  • nothings seams to happen though if i remove %ALLUSERSPROFILE% with my specific username it dose work, though obviously im trying to build this so it can be used with pultiple/ difrent profiles – philip Feb 09 '11 at 13:19
  • I do this but i dont get the point it simply pauses it up to this point thats all. What is your plan with this once i have paused it? – philip Feb 09 '11 at 13:29
  • The plan was to see what was output by the `echo` statements that you created by prefixing your problematic commands with the word `echo`. But I'm pretty certain we've nailed it based on what I discovered myself. Those two variables are _already_ full path names so you're going to end up with `C:\"Documents and settings\C:\Documents and settings\\Menu Start ...`. – paxdiablo Feb 09 '11 at 13:31
  • My appologies I see the problem now. The %ALLUSERSPROFILE% is not recognied (the pause shows it is compleatly missing, this confirms my suspicion) though If i replace %ALLUSRESPROFILE% with Philip.DEMAR it works but then it obviously only works for me. I need it to work under all our users profiles. hope this helps? – philip Feb 09 '11 at 13:36
  • @philip: confirm the spelling: ALLUSERSPROFILE is fine on my box. You had mistakenly used `USERSPROFILE` which should have been `USERPROFILE` - are you sure you've correctly identified the mising one? Open up a command window and enter the two commands `echo %USERPROFILE%` and `echo %ALLUSERSPROFILE%`. – paxdiablo Feb 09 '11 at 13:40
  • okay i tested the script and i am now able to copy my batch to the start menu sucesfully but despite reflecting the fix within the delete statement it still has no effect, I have troble more often with *.lnk files is this perhaps what is wrong that LNK files are protected by windows? – philip Feb 09 '11 at 14:22
0

Try executing the script in batch mode: cscript "C:\VBS\SHORTCUT.vbs" //B

It will suppress script errors and prompts however!

tzup
  • 3,566
  • 3
  • 26
  • 34
-1

Go to a command prompt and type

echo %userprofile%

It will come back with "C:\Documents and Settings\YourProfileName"

You are trying to delete a non-existent directory..

del /s/q/f C:\"Documents and settings\C:\Documents and Settings\YourProfileName\Menu Start\Programs\Hendrika's AutoCAD Instellingen\Uninstall Hendrika's AutoCAD Instellingen.lnk"

%userprofile% all ready contains the "C:\Documents and Settings\Username" part of the path.

Same thing with %ALLUSERSPROFILE%.

      (You ARE typing USERprofile and not USER**S**profile, right? ;-)  )