kairozamorro's hangout

Blog

Compatibility Sword as a system command and relative paths

kairozamorro Posted by kairozamorro at 06:16 PM on October 30, 2009

Probably not the most useful thing but I'd thought I'd point it out. You can use relative paths in command prompt like ., .., or \ as a directory with Compatibility Sword. Watch the directory open up for you in a new command window. You might even be able to use variables which is great, say in batch programs. Pretty useful when you need to do tasks that require mutliple windows. I was going to add this functionality through some additional switches  but apparently Windows does it for us.

 

Quick breakdown for us that don't mess around with command prompts too often:

. = current directory

.. = parent of current directory

\ = root directory of the drive of the current directory

 

So here's what I'm thinking... wouldn't it be cool to have a way to open a new command prompt window that would be elevated from the current directory in the command window you forgot to elevate? Thanks to Compatibility Sword  and Windows playing nice this is quite easy.

 

You'll need Compatibility Sword 2.0 or later for the following to work correctly. Drop Compatibility Sword in your c:\windows\system32 directory or in 2.1 or later click the "Make System Command" link in the user interface. All done! Now to use...

 

csword . /uac

 

Simple enough right? You can toss out the /uac switch if you just want another window. CSword's now a system command, which means you can just refer to it as csword ... in command prompts or csword at a run dialog/creating new shortcuts regardless of directory that you may be in. It'll make it much easier to write batch files that use CSword to carry out application compatibility tasks as well. Any user (including non-admin users) well be able to use it (since everyone should have at least read access to the system32 directory).

Categories: Tech, 2009 Blog Posts

Post a Comment

You must be a member to comment on this page. Sign In or Register

23 Comments

Coolname007
Reply Coolname007
05:18 PM on November 03, 2009
Ok, how about this.
Have it automatically install the CSword command-line version in the /system32 directory, and let the user decide where to put the GUI version.
I haven't tried CSword from Vista yet, but I'm assuming when you open a command prompt from it, its elevated? If not, you'll definitely want to consider it.
Coolname007
Reply Coolname007
05:23 PM on November 03, 2009
And perhaps the directory feature's default directory opened in the file browser could be system32.
kairozamorro
Reply kairozamorro
10:19 PM on November 03, 2009
CSword's a portable GUI and command line utility in one. There is no separate command line and GUI versions. I may include an option in the GUI to make it a system command for you, but generally its not a good idea to have programs start copying over stuff without user permission. Because 99% of the tasks CSword performs doesn't require admin privallages its necessary to throw in the /uac switch if you want an elevated command prompt. Even with that its a lot quicker then having to go hunt down an admin command window to the directory you want.

Coolname007 says...
And perhaps the directory feature's default directory opened in the file browser could be system32.


Don't know what you mean. There's a /dir switch that opens file browser to current directory. Is that what you're talking about?
Coolname007
Reply Coolname007
10:42 PM on November 03, 2009
kairozamorro says...
CSword's a portable GUI and command line utility in one. There is no separate command line and GUI versions.

Well, I guessed that much already, since I didn't see any separate executable file included in the download, but perhaps you could make a separate command-line version? I don't know...just a thought.
kairozamorro says...
I may include an option in the GUI to make it a system command for you, but generally its not a good idea to have programs start copying over stuff without user permission. Because 99% of the tasks CSword performs doesn't require admin privallages its necessary to throw in the /uac switch if you want an elevated command prompt. Even with that its a lot quicker then having to go hunt down an admin command window to the directory you want.

Don't you think its better to have it automatically open an elevated command prompt every single time, from the GUI, when you're using it in Vista/7?
kairozamorro says...
Don't know what you mean. There's a /dir switch that opens file browser to current directory. Is that what you're talking about?

Run option. I was wondering if you could change the default directory it opens to, to the system32 directory.
kairozamorro
Reply kairozamorro
10:43 PM on November 03, 2009
Coolname007 says...
I haven't tried CSword from Vista yet, but I'm assuming when you open a command prompt from it, its elevated? If not, you'll definitely want to consider it.


That's one of the main points this tutorial illustrates. Use . + /uac and a new eleavted command window is opened. CSword is indeed best used in a UAC environment like Vista/W7.
Coolname007
Reply Coolname007
10:46 PM on November 03, 2009
Whoops...looks like the comment thing cut off some of what I wrote. And when I tried to edit it, it sent me to a Webs error page...

Whatever. Anyway, what I was saying that the comment thing cut off is:

kairozamorro says...
Don't know what you mean. There's a /dir switch that opens file browser to current directory. Is that what you're talking about?

Run option in Csword. I was wondering if you could change the default directory it opens to, to the system32 directory.

kairozamorro says...
CSword's a portable GUI and command line utility in one. There is no separate command line and GUI versions.
Well, I guessed that much already, since I didn't see any separate executable file included in the download, but perhaps you could make a separate command-line version? I don't know...just a thought.
kairozamorro says...
I may include an option in the GUI to make it a system command for you, but generally its not a good idea to have programs start copying over stuff without user permission. Because 99% of the tasks CSword performs doesn't require admin privallages its necessary to throw in the /uac switch if you want an elevated command prompt. Even with that its a lot quicker then having to go hunt down an admin command window to the directory you want.
Don't you think its better to have it automatically open an elevated command prompt every single time, from the GUI, when you're using it in Vista/7?
kairozamorro says...
Don't know what you mean. There's a /dir switch that opens file browser to current directory. Is that what you're talking about?
Run option. I was wondering if you could change the default directory it opens to, to the system32 directory.
kairozamorro
Reply kairozamorro
10:49 PM on November 03, 2009
Coolname007 says...
Don't you think its better to have it automatically open an elevated command prompt every single time, from the GUI, when you're using it in Vista/7?


Not exactly. There may be situations where you don't need or don't have admin access on the computer. The option to elevate is right next to the run button. Its not that hard to select it...

Coolname007 says...
Run option. I was wondering if you could change the default directory it opens to, to the system32 directory.


I may include a new switch for this, say /sys so you don't haft to type out c:\windows\system32 if thats what you want to do. Good idea smile
Coolname007
Reply Coolname007
10:49 PM on November 03, 2009
Ok, now its getting a little annoying...
Now the comment thing just put a new comment I posted at the top of my last comment (and truncated some of it again).

Run option in Csword, i.e. the file browser that opens up. I was wondering if you could change the default directory of that to the system32 directory.
Coolname007
Reply Coolname007
10:52 PM on November 03, 2009
What is wrong with this comment thing? smilesmile
It took half of my sentence out again...

Oh well, forget it.
kairozamorro
Reply kairozamorro
10:54 PM on November 03, 2009
Coolname007 says...
Ok, now its getting a little annoying...
Now the comment thing just put a new comment I posted at the top of my last comment (and truncated some of it again).

Run option in Csword, i.e. the file browser that opens up. I was wondering if you could change the default directory of that to the system32 directory.


The /dir option is meant to open current directory in file browser. I'll add another parameter like /sysdir to do what you want. And yeah... blogs doing some funky things. Looks like they upgraded the blog app and didn't bother testing sad
Coolname007
Reply Coolname007
11:02 PM on November 03, 2009
You're still talking command-line here, though, right?
I meant when you click the Run button in the GUI of CSword, though I imagine it probably opens the same thing when you run the csword command with /dir switch...
kairozamorro
Reply kairozamorro
11:09 PM on November 03, 2009
There is no /dir equivalent to open file browser in UI, only open command window with the directory you picked just like FileDir2Prompt did.
Coolname007
Reply Coolname007
11:24 PM on November 03, 2009
Ok, then you were completely talking about the command-line then, and I was completely talking about the GUI.
Directory | Run is what I'm referring to. A window pops up. It is a file browser.
In this file browser, I wish for the default directory to be system32.

That is all I was saying...
kairozamorro
Reply kairozamorro
11:29 PM on November 03, 2009
Ok, I think I get what you're saying.... thing is, I would also haft to default to elevate to get it the way you want it right? Ok, two options then....

If you didn't specify a directory sysdir is assumed and elevated instead of displaying an error.

Or most likely choice...

I create a new button there that pre-fills and runs it for you in one click.
Coolname007
Reply Coolname007
11:44 PM on November 03, 2009
kairozamorro says...
Ok, I think I get what you're saying.... thing is, I would also haft to default to elevate to get it the way you want it right? Ok, two options then....

I don't know. Possibly...
I'm not sure what kind of restrictions Win Vista/7 put on that directory. It could be UAC would kick in, and force you to give permission (a non-option for non-admins).
kairozamorro says...
If you didn't specify a directory sysdir is assumed and elevated instead of displaying an error.

Or most likely choice...

I create a new button there that pre-fills and runs it for you in one click.

I'm not sure if I understand you...
You're saying if you don't specify a directory via the COMMAND-LINE (or GUI?), sysdir is assumed and elevated instead of displaying an error?
What exactly would this button be auto-filling?
kairozamorro
Reply kairozamorro
11:58 PM on November 03, 2009
It would auto-fill directory selection, enable the elevate option, and open the sys directory in one click.
Coolname007
Reply Coolname007
12:06 AM on November 04, 2009
Yeah, that sounds about right. smile
Cool, I hope you do this. The system32 directory is where all of MS's command-line utilities are stored, and I'm sure some 3rd party software install there too. Having that option would be useful.
kairozamorro
Reply kairozamorro
12:12 AM on November 04, 2009
If that's why you need it its not needed. Just like CSword when copied to sys directory, you can run any command-line app in the system32 directory simply by referring to it (you don't haft to type full path regardless of what the current directory is). You do this all the time whether you realize it or not. For example, defrag, chkdsk, diskpart, bcdedit, etc. You never type "c:\windows\system32\chkdsk.exe c:", you just type "chkdsk c:".
Coolname007
Reply Coolname007
12:18 AM on November 04, 2009
kairozamorro says...
If that's why you need it its not needed. Just like CSword when copied to sys directory, you can run any command-line app in the system32 directory simply by referring to it (you don't haft to type full path regardless of what the current directory is). You do this all the time whether you realize it or not. For example, defrag, chkdsk, diskpart, bcdedit, etc. You never type "c:\windows\system32\chkdsk.exe c:", you just type "chkdsk c:".

Yeah, I'm aware of that, but that's because the command prompt opens up at that directory by default. If the appplication's a tool for making the command-line easier, then it seems to me, the easier the better! smile If you have it open the Application file browser at the system32 directory by default, then all you have to do to start a command-line utility located in there is scroll down, select it, and click the Run button.
Coolname007
Reply Coolname007
12:25 AM on November 04, 2009
And if you add that button, and have the directory feature open up at the system32 directory by default, it'll be just like you went to Start | All Programs | Accessories | Command Prompt and started it that way. Only less work..
And then if you wanted to go to a different directory in the command prompt, you simply browse for it immediately, in the GUI.