Jump to content

Can't run a .bat file from USB Flash drive!?


liorshwa

Recommended Posts

i have a .bat file that contains the following:

cd "%windir%\resources\themes\Embedded"
Embedded.msstyles
WinWait("Display Properties", "", 5)
cd "%userprofile%\desktop"
ThemeChange.exe

and when i run it from the desktop it works but when i run the same file from my USB Flash drive it says:

Embedded.msstyles" is not recognized as an internal or external command.

can some1 help me PLZ

Link to comment
Share on other sites


  • Replies 2
  • Views 1.1k
  • Created
  • Last Reply

The search will still be on your USB stick. You need to reference the drive as well.

Assuming C: is the Windows drive

One way would be:

cd "%windir%\resources\themes\Embedded"
C:Embedded.msstyles
C:WinWait("Display Properties", "", 5)
cd "%userprofile%\desktop"
C:ThemeChange.exe

OR (something like)

cd "%windir%\resources\themes\Embedded"

"%windir%\resources\themes\Embedded\Embedded.msstyles"

"%windir%\resources\themes\Embedded\WinWait("Display Properties", "", 5)"
cd "%userprofile%\desktop"

"%userprofile%\desktop\ThemeChange.exe"

OR (on my system I note that both %homedrive% and %systemdrive" returns C:)

I think this is probably the "proper" way to do it:

cd "%windir%\resources\themes\Embedded"

%systemdrive%Embedded.msstyles

%systemdrive%WinWait("Display Properties", "", 5)
cd "%userprofile%\desktop"

%systemdrive%ThemeChange.exe

IF you fire up a cmd window, type "set" and you'll see a bunch of useful environment variables

I'm making some guesses in my interpretation of your batch file, but I hope that I've given you the gist of what to try. Good luck.

Link to comment
Share on other sites


Ooops. Even easier, just add %systemdrive% at the start of you batch file. That'll make e.g. C: be the current drive.

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...