Computing.Net > Forums > Programming > batch inport reg

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch inport reg

Reply to Message Icon

Name: momchil
Date: November 1, 2007 at 08:03:04 Pacific
OS: xp/2000
CPU/Ram: intel
Comment:

reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v KillAVG /t REG_SZ /D "%cd%\KillAVG_Vista.cmd" /f

the thing is that %cd% may contain whitespaces.. is there a way to convert this to short file name ( progra~1)

Thank you



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 1, 2007 at 08:37:17 Pacific
Reply:

Yes, you have to issue

Command /C CD

*before* the line where you code the %cd% variable.

The drawback however is that the short format is now retained until you close the batch or prompt window, no matter you issue NT commands or DOS compatible ones.


0

Response Number 2
Name: momchil
Date: November 1, 2007 at 08:55:20 Pacific
Reply:

Thank you that did the job.
This is followed by a restart so I guess it is OK :) Thanks again


0

Response Number 3
Name: klint
Date: November 2, 2007 at 10:41:00 Pacific
Reply:

Alternatively:

for %%D in ("%CD%") do set ShortCD=%%~sD

Followed by your original command line, substituting ShortCD for CD.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


batch file comparison Finding the last instance...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch inport reg

Reg in batch help www.computing.net/answers/programming/reg-in-batch-help/17168.html

Batch Scripting .REG autostart Help www.computing.net/answers/programming/batch-scripting-reg-autostart-help/9463.html

Reading reg keys vbs www.computing.net/answers/programming/reading-reg-keys-vbs/14366.html