Computing.Net > Forums > Programming > Waht is wrong? It won't work

Waht is wrong? It won't work

Reply to Message Icon

Original Message
Name: hatlad
Date: January 8, 2008 at 18:13:41 Pacific
Subject: Waht is wrong? It won't work
OS: Windows XP home
CPU/Ram: 512mb
Model/Manufacturer: Dell Custom
Comment:

What is wrong with the following line of batch? I don't know but it won't run.
_____________________________________________

move "%userprofile%\My Documents\Misc\Applications\Batch files\hello.bat" "C:\Documents and Settings\All Users\Start Menu\Programs\Startup"
_____________________________________________

Can anyone help????

Cheese, the more you eat it, the less you care about how mouldy it is!


Report Offensive Message For Removal


Response Number 1
Name: hatlad
Date: January 8, 2008 at 18:14:50 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

It is on one line. Not multiple ones.

Cheese, the more you eat it, the less you care about how mouldy it is!


Report Offensive Follow Up For Removal

Response Number 2
Name: Razor2.3
Date: January 8, 2008 at 19:41:49 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

What error does it give?


Report Offensive Follow Up For Removal

Response Number 3
Name: MarkM
Date: January 9, 2008 at 00:19:45 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

You need to move the environment variable %userprofile% outside of the string quotes:

move %userprofile%"\My Documents\Misc\Applications\Batch files\hello.bat" "C:\Documents and Settings\All Users\Start Menu\Programs\Startup"


Report Offensive Follow Up For Removal

Response Number 4
Name: Razor2.3
Date: January 9, 2008 at 01:02:05 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

MarkM: You need to move the environment variable %userprofile% outside of the string quotes
No, you don't, and no you shouldn't.


Report Offensive Follow Up For Removal

Response Number 5
Name: MarkM
Date: January 9, 2008 at 01:13:40 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

Actually, you're right, don't need to do that. I should have tested it both ways before posting. But as far as "you shouldn't" - why not? It works just as well.

Personally, from a programming point of view, I think it makes more sense to have a variable outside a string literal.


Report Offensive Follow Up For Removal


Response Number 6
Name: Razor2.3
Date: January 9, 2008 at 02:37:14 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

'Cause variable expansion is done by a preprocessor.


Report Offensive Follow Up For Removal

Response Number 7
Name: tonysathre
Date: January 9, 2008 at 05:12:00 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

Is the name of your script hello.bat by chance? Are you trying to move the same script that your executing?

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal

Response Number 8
Name: klint
Date: January 9, 2008 at 05:43:52 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

Have you got administrator privileges?

Also, instead of "C:\Documents and Settings\All Users", you should use %ALLUSERSPROFILE%. This directory is configurable and therefore may not be where you state it is.


Report Offensive Follow Up For Removal

Response Number 9
Name: User123456789
Date: January 9, 2008 at 07:56:36 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

As stated; what is the error message seen ?

Hi there.


Report Offensive Follow Up For Removal

Response Number 10
Name: hatlad
Date: January 9, 2008 at 18:00:38 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

it says, "The system cannot find the path specified"

Cheese, the more you eat it, the less you care about how mouldy it is!


Report Offensive Follow Up For Removal

Response Number 11
Name: Razor2.3
Date: January 9, 2008 at 19:02:46 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

Then either %userprofile%\My Documents\Misc\Applications\Batch files\ doesn't exist, or C:\Documents and Settings\All Users\Start Menu\Programs\Startup doesn't exist. Either try the full path without the %userprofile%, or replace C:\Documents and Settings\All Users with %AllUsersProfile%.

EDIT: You can test your script by adding the following two lines:

IF EXIST "%userprofile%\My Documents\Misc\Applications\Batch files\hello.bat" ECHO Source good
IF EXIST "C:\Documents and Settings\All Users\Start Menu\Programs\Startup" ECHO Dest good

Report Offensive Follow Up For Removal

Response Number 12
Name: klint
Date: January 10, 2008 at 02:01:40 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

I'm sorry if I sound harsh but I would like to know why you didn't find the error message "The system cannot find the path specified" helpful enough for you to solve the problem yourself. I mean what is there about the message that does not give you obvious clues as to where to look for the problem? If you have already checked the existence of the source file and destination directory, then I apologise.


Report Offensive Follow Up For Removal

Response Number 13
Name: hatlad
Date: January 10, 2008 at 19:44:23 Pacific
Subject: Waht is wrong? It won't work
Reply: (edit)

klint: I kept trying to find the correct patch but it didn't work. I though i was putting a comma in the wrong place or something and u guys r good at that.

I fixed it with the following line. the destination was good so i replaced it with just hello.bat (this batch file and hello.bat r in the same folder)
_____________________________________________
move "hello.bat" "%ALLUSERSPROFILE%\Start Menu\Programs\Startup"
_____________________________________________

Cheese, the more you eat it, the less you care about how mouldy it is!


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Waht is wrong?  It won't work

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge