Computing.Net > Forums > Windows XP > Editing variables in batch files.

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.

Editing variables in batch files.

Reply to Message Icon

Name: Lisa23
Date: May 28, 2005 at 18:26:08 Pacific
OS: Win XP Pro
CPU/Ram: 3.0Ghz P4 - 1GB Ram
Comment:

OK, I hope I can explain this well enough for some genius to understand and help me out

Im going to make a batch file that will be loaded by right-clicking mp3 files and selecting "some option" from the context menu.

Assuming I save this batch file as: C:\Windows\test.bat

Now, on right-clicking an mp3 file I will have an option that, if selected, will perform the following run command: "C:\Windows\test.bat" %1

The %1 automatically sets the selected mp3s filepath as a variable called %1 in the batch file.

So lets say I rightclick on C:\music\coolsong.mp3 and select "the option" from the menu... C:\Windows\test.bat will now load up and have the variable %1 which = "C:\music\coolsong.mp3"

Now here is what I want to do with this %1 variable:

I want to create a new variable with the selected mp3s directory path instead of the filepath. So for this example I will need to somehow set a variable which = "C:\music\"

I really don't know what to do. All I want is to take the variable I already have ("C:\music\coolsong.mp3") and transform it to: "C:\music\"

I really hope somebody here can help me out.

If anything, maybe someone here knows of a forum that I can join which specializes in topics about creating batch files?? It would really help me out.

Thanks alot everyone.



Sponsored Link
Ads by Google

Response Number 1
Name: Ed in Texas.
Date: May 29, 2005 at 01:27:56 Pacific
Reply:

Lisa23 been a WHILE since I did any programming, but seems to me that a simple if-then-else statement is all you need. What if you have the machine check for some keypress (flag) for example and if that key's depressed, change the name to whatever you enter, otherwise leave it alone? Forum? Sure there's one, dunno.
HTH.
Ed in Texas.


0
Reply to Message Icon

Related Posts

See More


getting back autoplay Re-Install IE in Windows ...



Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Editing variables in batch files.

variables in batch file www.computing.net/answers/windows-xp/variables-in-batch-file/94735.html

How can I print out a variable in batch file www.computing.net/answers/windows-xp/how-can-i-print-out-a-variable-in-batch-file/179789.html

difference b/w %%g and %g% in batch file www.computing.net/answers/windows-xp/difference-bw-g-and-g-in-batch-file/176113.html